Skip to content

Commit

Permalink
adjust test cases to new annotation style
Browse files Browse the repository at this point in the history
  • Loading branch information
theron-wang committed Jul 3, 2024
1 parent 1cbc328 commit e4d4526
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,26 @@ private void handleAnnotationValue(Expression value) {
// All elements in the same array will be the same type
handleAnnotationValue(values.get(0));
} else if (value.isClassExpr()) {
ResolvedType resolved = value.asClassExpr().calculateResolvedType();
try {
ResolvedType resolved = value.asClassExpr().calculateResolvedType();

if (resolved.isReferenceType()) {
usedClass.add(resolved.asReferenceType().getQualifiedName());
if (resolved.isReferenceType()) {
usedClass.add(resolved.asReferenceType().getQualifiedName());
}
} catch (UnsolvedSymbolException ex) {
// TODO: retrigger synthetic type generation
return;
}
} else if (value.isFieldAccessExpr()) {
ResolvedType resolved = value.asFieldAccessExpr().calculateResolvedType();
try {
ResolvedType resolved = value.asFieldAccessExpr().calculateResolvedType();

if (resolved.isReferenceType()) {
usedClass.add(resolved.asReferenceType().getQualifiedName());
if (resolved.isReferenceType()) {
usedClass.add(resolved.asReferenceType().getQualifiedName());
}
} catch (UnsolvedSymbolException ex) {
// TODO: retrigger synthetic type generation
return;
}
} else if (value.isAnnotationExpr()) {
// Create a NodeList so we can re-handle the annotation in handleAnnotations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.example;

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

@Target(ElementType.TYPE_USE)
public @interface PostconditionAnnotation {

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.example;

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

@Target(ElementType.TYPE_USE)
public @interface PreconditionAnnotation {

}
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
package org.checkerframework.checker.nullness.qual;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import org.checkerframework.framework.qual.DefaultFor;
import org.checkerframework.framework.qual.QualifierForLiterals;
import org.checkerframework.framework.qual.SubtypeOf;

@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE_USE, ElementType.TYPE_PARAMETER })
@SubtypeOf({})
@QualifierForLiterals({ LiteralKind.NULL })
@DefaultFor(types = { Void.class })
@Target(ElementType.TYPE_USE)
public @interface Nullable {
}

0 comments on commit e4d4526

Please sign in to comment.