Skip to content

Commit

Permalink
Add error to test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Ao-senXiong committed May 2, 2024
1 parent d365abc commit f75590d
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions testinput/typecheck/AnnotationApplicationOrder.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
public class AnnotationApplicationOrder {
static Object o;// PICOTreeAnnotator takes care of static fields
// :: error: (initialization.field.uninitialized)
BigDecimal decimal;// PICOImplicitsTypeAnnotator takes care of it
Date date;// QualifierDefaults takes care of it
}
2 changes: 1 addition & 1 deletion testinput/typecheck/AssignableExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class AssignableExample {
@Immutable Object o;
@Immutable Date date;
@Assignable @Immutable Date assignableDate;

// :: error: (initialization.fields.uninitialized)
@Mutable AssignableExample() {
o = new @Immutable Object();
}
Expand Down
1 change: 0 additions & 1 deletion testinput/typecheck/DateCell.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

@ReceiverDependantMutable public class DateCell {

// :: error: (initialization.field.uninitialized)
@ReceiverDependantMutable Date date;

@ReceiverDependantMutable Date getDate(@ReceiverDependantMutable DateCell this) {
Expand Down
2 changes: 1 addition & 1 deletion testinput/typecheck/EnumConstantNotAlwaysMutable.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class EnumConstantNotAlwaysMutable {
@Mutable Kind invalidKind2;
// no error now
@Readonly Kind invalidKind3;

// :: error: (initialization.fields.uninitialized)
EnumConstantNotAlwaysMutable() {
// Kind.SOME should be @Immutable
kind = Kind.SOME;
Expand Down
1 change: 0 additions & 1 deletion testinput/typecheck/FieldAssignment.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ void setFWithMutableReceiver(@UnderInitialization @Mutable FieldAssignment this,

// TODO This is not specific to PICO type system. InitializationVisitor currently has this issue of false positively
// wanrning uninitialized fields when we use instance method to initialiaze fields
// :: error: (initialization.fields.uninitialized)
public FieldAssignment() {
// :: error: (method.invocation.invalid)
setFWithMutableReceiver(new @Mutable Object());
Expand Down
2 changes: 1 addition & 1 deletion testinput/typecheck/FieldsInitialized.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class FieldsInitialized {
@Assignable @ReceiverDependantMutable Object f8;
@Assignable @Mutable Object f9;
@Assignable @Readonly Object f10;

// :: error: (initialization.fields.uninitialized)
@ReceiverDependantMutable FieldsInitialized() {
f1 = new @Immutable Object();
f2 = new @Immutable Object();
Expand Down
1 change: 1 addition & 0 deletions testinput/typecheck/GenericInterfaces.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ void raw() {

// Using optimictic uninferred type arguments, so it is
// allowed
// :: error: (assignment.type.incompatible)
@Immutable Object ro = raw.next();
}
}
3 changes: 3 additions & 0 deletions testinput/typecheck/InvalidAssignability.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@

public class InvalidAssignability {
final @Immutable Object io = null;
// :: error: (initialization.field.uninitialized)
@Immutable Object io2;
// :: error: (initialization.field.uninitialized)
@Assignable @Immutable Object io3;
static final @Immutable Object io4 = null;
// :: error: (initialization.static.field.uninitialized)
static @Assignable @Immutable Object io5;
// :: error: (one.assignability.invalid)
final @Assignable @Immutable Object o = null;
Expand Down
2 changes: 1 addition & 1 deletion testinput/typecheck/ObjectIdentityMethodTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ObjectIdentityMethodTest extends Super{
@Immutable A a5;
final A a6;
final @Immutable A a7;

// :: error: (initialization.fields.uninitialized)
ObjectIdentityMethodTest() {
a6 = new A();
a7 = new @Immutable A();
Expand Down
2 changes: 2 additions & 0 deletions testinput/typecheck/OnlyOneModifierIsUse.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
public class OnlyOneModifierIsUse {

// :: error: (type.invalid.conflicting.annos)
// :: error: (initialization.field.uninitialized)
@Readonly @Immutable Object field;
// :: error: (type.invalid.conflicting.annos)
// :: error: (initialization.field.uninitialized)
String @Readonly @Immutable [] array;
}
2 changes: 0 additions & 2 deletions testinput/typecheck/RDMBug.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
import qual.Readonly;

@Immutable class RDMBug {
// :: error: (initialization.field.uninitialized)
@Mutable Object o;
// :: error: (initialization.field.uninitialized)
@Readonly Object o2;
void foo(@Immutable RDMBug this) {
// :: error: (illegal.field.write)
Expand Down
2 changes: 1 addition & 1 deletion testinput/typecheck/RDMFieldInst.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ private static class RDMBox {}

@Immutable
private static class ImmutableClass {
// :: error: (type.invalid.annotations.on.use) :: error: (initialization.field.uninitialized)
// :: error: (type.invalid.annotations.on.use)
@ReceiverDependantMutable MutableBox mutableBoxInRDM;
}

Expand Down
2 changes: 1 addition & 1 deletion testinput/typecheck/SupportedBuilderPattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static class Builder {
private final int id;
private String address;
private @Immutable Date date;

// :: error: (initialization.fields.uninitialized)
public Builder(int id) {
this.id = id;
}
Expand Down

0 comments on commit f75590d

Please sign in to comment.