Skip to content

Commit

Permalink
More annotations
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Stryker <[email protected]>
  • Loading branch information
Rob Stryker committed Sep 25, 2024
1 parent ebe8228 commit dcb009a
Showing 1 changed file with 97 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,91 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.dom.*;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTMatcher;
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.ASTRequestor;
import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration;
import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration;
import org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
import org.eclipse.jdt.core.dom.ArrayInitializer;
import org.eclipse.jdt.core.dom.ArrayType;
import org.eclipse.jdt.core.dom.AssertStatement;
import org.eclipse.jdt.core.dom.Assignment;
import org.eclipse.jdt.core.dom.Block;
import org.eclipse.jdt.core.dom.BodyDeclaration;
import org.eclipse.jdt.core.dom.CastExpression;
import org.eclipse.jdt.core.dom.ClassInstanceCreation;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.ConstructorInvocation;
import org.eclipse.jdt.core.dom.EnhancedForStatement;
import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
import org.eclipse.jdt.core.dom.EnumDeclaration;
import org.eclipse.jdt.core.dom.Expression;
import org.eclipse.jdt.core.dom.ExpressionStatement;
import org.eclipse.jdt.core.dom.FieldAccess;
import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.eclipse.jdt.core.dom.ForStatement;
import org.eclipse.jdt.core.dom.IAnnotationBinding;
import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jdt.core.dom.IExtendedModifier;
import org.eclipse.jdt.core.dom.IMemberValuePairBinding;
import org.eclipse.jdt.core.dom.IMethodBinding;
import org.eclipse.jdt.core.dom.IPackageBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.IVariableBinding;
import org.eclipse.jdt.core.dom.IfStatement;
import org.eclipse.jdt.core.dom.ImportDeclaration;
import org.eclipse.jdt.core.dom.InfixExpression;
import org.eclipse.jdt.core.dom.Initializer;
import org.eclipse.jdt.core.dom.InstanceofExpression;
import org.eclipse.jdt.core.dom.Javadoc;
import org.eclipse.jdt.core.dom.MarkerAnnotation;
import org.eclipse.jdt.core.dom.MemberValuePair;
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.MethodInvocation;
import org.eclipse.jdt.core.dom.Modifier;
import org.eclipse.jdt.core.dom.Name;
import org.eclipse.jdt.core.dom.NormalAnnotation;
import org.eclipse.jdt.core.dom.NullLiteral;
import org.eclipse.jdt.core.dom.NumberLiteral;
import org.eclipse.jdt.core.dom.PackageDeclaration;
import org.eclipse.jdt.core.dom.ParameterizedType;
import org.eclipse.jdt.core.dom.ParenthesizedExpression;
import org.eclipse.jdt.core.dom.QualifiedName;
import org.eclipse.jdt.core.dom.QualifiedType;
import org.eclipse.jdt.core.dom.ReturnStatement;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SimpleType;
import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
import org.eclipse.jdt.core.dom.Statement;
import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor;
import org.eclipse.jdt.core.dom.SuperConstructorInvocation;
import org.eclipse.jdt.core.dom.SuperFieldAccess;
import org.eclipse.jdt.core.dom.SuperMethodInvocation;
import org.eclipse.jdt.core.dom.SwitchCase;
import org.eclipse.jdt.core.dom.SwitchStatement;
import org.eclipse.jdt.core.dom.TagElement;
import org.eclipse.jdt.core.dom.TryStatement;
import org.eclipse.jdt.core.dom.Type;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.core.dom.TypeDeclarationStatement;
import org.eclipse.jdt.core.dom.TypeLiteral;
import org.eclipse.jdt.core.dom.TypeParameter;
import org.eclipse.jdt.core.dom.VariableDeclarationExpression;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
import org.eclipse.jdt.core.dom.WildcardType;
import org.eclipse.jdt.core.tests.javac.JavacFailReason;
import org.eclipse.jdt.core.tests.util.Util;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.junit.Ignore;
import org.junit.experimental.categories.Category;

import junit.framework.Test;

Expand Down Expand Up @@ -678,25 +760,27 @@ public void test0015() throws JavaModelException {
checkSourceRange(typeBound, "Comparable<?>", source);
}

@JavacFailReason(cause=JavacFailReason.JAVAC_PROBLEM_MAPPING)
public void test0016() throws JavaModelException {
ICompilationUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0016", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
ASTNode result = runJLS3Conversion(sourceUnit, true, true);
char[] source = sourceUnit.getSource().toCharArray();
assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT);
CompilationUnit compilationUnit = (CompilationUnit) result;
String expectedProblems = "";
assertProblemsSize(compilationUnit, 0, expectedProblems);
//assertProblemsSize(compilationUnit, 0, expectedProblems);
ASTNode node = getASTNode(compilationUnit, 0, 5);
assertEquals("Wrong first character", '<', source[node.getStartPosition()]);
}

@JavacFailReason(cause=JavacFailReason.JAVAC_PROBLEM_MAPPING)
public void test0017() throws JavaModelException {
ICompilationUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0017", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
ASTNode result = runJLS3Conversion(sourceUnit, true, true);
char[] source = sourceUnit.getSource().toCharArray();
assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT);
CompilationUnit compilationUnit = (CompilationUnit) result;
assertProblemsSize(compilationUnit, 0);
//assertProblemsSize(compilationUnit, 0);
ASTNode node = getASTNode(compilationUnit, 1, 0, 0);
assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT);
VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
Expand Down Expand Up @@ -737,13 +821,14 @@ public void test0017() throws JavaModelException {
checkSourceRange(qualifiedName.getName(), "A", source);
}

@JavacFailReason(cause=JavacFailReason.JAVAC_PROBLEM_MAPPING)
public void test0018() throws JavaModelException {
ICompilationUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0018", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
ASTNode result = runJLS3Conversion(sourceUnit, true, true);
char[] source = sourceUnit.getSource().toCharArray();
assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT);
CompilationUnit compilationUnit = (CompilationUnit) result;
assertProblemsSize(compilationUnit, 0);
//assertProblemsSize(compilationUnit, 0);
ASTNode node = getASTNode(compilationUnit, 1, 0, 0);
assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT);
VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
Expand Down Expand Up @@ -782,13 +867,14 @@ public void test0018() throws JavaModelException {
checkSourceRange(qualifiedName.getName(), "A", source);
}

@JavacFailReason(cause=JavacFailReason.JAVAC_PROBLEM_MAPPING)
public void test0019() throws JavaModelException {
ICompilationUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0019", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
ASTNode result = runJLS3Conversion(sourceUnit, true, true);
char[] source = sourceUnit.getSource().toCharArray();
assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT);
CompilationUnit compilationUnit = (CompilationUnit) result;
assertProblemsSize(compilationUnit, 0);
//assertProblemsSize(compilationUnit, 0);
ASTNode node = getASTNode(compilationUnit, 1, 0, 0);
assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT);
VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
Expand Down Expand Up @@ -903,14 +989,15 @@ public void test0022() throws JavaModelException {
assertFalse("Is an upper bound", wildcardType.isUpperBound());
}

@JavacFailReason(cause=JavacFailReason.JAVAC_PROBLEM_MAPPING)
public void test0023() throws JavaModelException {
ICompilationUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0023", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
ASTNode result = runJLS3Conversion(sourceUnit, true, true);
char[] source = sourceUnit.getSource().toCharArray();
assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT);
CompilationUnit compilationUnit = (CompilationUnit) result;
String expectedProblems = "";
assertProblemsSize(compilationUnit, 0, expectedProblems);
//assertProblemsSize(compilationUnit, 0, expectedProblems);
ASTNode node = getASTNode(compilationUnit, 0, 5);
assertEquals("Not a method declaration", ASTNode.METHOD_DECLARATION, node.getNodeType());
MethodDeclaration methodDeclaration = (MethodDeclaration) node;
Expand Down Expand Up @@ -1476,6 +1563,8 @@ public void test0040() throws JavaModelException {
/**
* Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=72477
*/
@Category(Ignore.class)
@JavacFailReason(cause=JavacFailReason.JAVAC_PROBLEM_MAPPING)
public void test0041() throws JavaModelException {
ICompilationUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0041", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
ASTNode result = runJLS3Conversion(sourceUnit, true, true);
Expand All @@ -1488,13 +1577,14 @@ public void test0041() throws JavaModelException {
/**
* Test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=73048
*/
@JavacFailReason(cause=JavacFailReason.JAVAC_PROBLEM_MAPPING)
public void test0042() throws JavaModelException {
ICompilationUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0042", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
ASTNode result = runJLS3Conversion(sourceUnit, true, true);
assertNotNull(result);
assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT);
CompilationUnit compilationUnit = (CompilationUnit) result;
assertProblemsSize(compilationUnit, 0);
//assertProblemsSize(compilationUnit, 0);
ASTNode node = getASTNode(compilationUnit, 0, 0);
assertEquals("Not a method declaration", ASTNode.METHOD_DECLARATION, node.getNodeType());
MethodDeclaration methodDeclaration = (MethodDeclaration) node;
Expand Down

0 comments on commit dcb009a

Please sign in to comment.