Control: forwarded -1 https://github.com/nhatminhle/cofoja/issues/52

The IllegalArgumentException thrown by ASM can be fixed either
by upgrading ASM or setting the source/target level on the <javac> task.

There is another issue hidden behind this one though. Cofoja uses
internal JDK classes and it now breaks badly:

  build:
      [mkdir] Created dir: cofoja/obj/bare
     [ujavac] Compiling 86 source files to cofoja/obj/bare
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:20: 
error: package com.sun.source.tree does not exist
     [ujavac] import com.sun.source.tree.AnnotationTree;
     [ujavac]                           ^
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:21: 
error: package com.sun.source.tree does not exist
     [ujavac] import com.sun.source.tree.AssignmentTree;
     [ujavac]                           ^
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:22: 
error: package com.sun.source.tree does not exist
     [ujavac] import com.sun.source.tree.CompilationUnitTree;
     [ujavac]                           ^
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:23: 
error: package com.sun.source.tree does not exist
     [ujavac] import com.sun.source.tree.ExpressionTree;
     [ujavac]                           ^
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:24: 
error: package com.sun.source.tree does not exist
     [ujavac] import com.sun.source.tree.ImportTree;
     [ujavac]                           ^
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:25: 
error: package com.sun.source.tree does not exist
     [ujavac] import com.sun.source.tree.LineMap;
     [ujavac]                           ^
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:26: 
error: package com.sun.source.tree does not exist
     [ujavac] import com.sun.source.tree.NewArrayTree;
     [ujavac]                           ^
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:27: 
error: package com.sun.source.tree.Tree does not exist
     [ujavac] import com.sun.source.tree.Tree.Kind;
     [ujavac]                                ^
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:28: 
error: package com.sun.source.util does not exist
     [ujavac] import com.sun.source.util.SourcePositions;
     [ujavac]                           ^
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:29: 
error: package com.sun.source.util does not exist
     [ujavac] import com.sun.source.util.TreePath;
     [ujavac]                           ^
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:30: 
error: package com.sun.source.util does not exist
     [ujavac] import com.sun.source.util.Trees;
     [ujavac]                           ^
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:61: 
error: cannot find symbol
     [ujavac]     Trees treeUtils = Trees.instance(processingEnv);
     [ujavac]     ^
     [ujavac]   symbol:   class Trees
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:61: 
error: cannot find symbol
     [ujavac]     Trees treeUtils = Trees.instance(processingEnv);
     [ujavac]                       ^
     [ujavac]   symbol:   variable Trees
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:66: 
error: cannot find symbol
     [ujavac]     TreePath path = treeUtils.getPath(element, annotation);
     [ujavac]     ^
     [ujavac]   symbol:   class TreePath
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:71: 
error: cannot find symbol
     [ujavac]     CompilationUnitTree unitTree = path.getCompilationUnit();
     [ujavac]     ^
     [ujavac]   symbol:   class CompilationUnitTree
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:72: 
error: cannot find symbol
     [ujavac]     LineMap lineMap = unitTree.getLineMap();
     [ujavac]     ^
     [ujavac]   symbol:   class LineMap
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:73: 
error: cannot find symbol
     [ujavac]     SourcePositions positions = treeUtils.getSourcePositions();
     [ujavac]     ^
     [ujavac]   symbol:   class SourcePositions
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:75: 
error: cannot find symbol
     [ujavac]     AnnotationTree annotationTree = (AnnotationTree) 
path.getLeaf();
     [ujavac]     ^
     [ujavac]   symbol:   class AnnotationTree
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:75: 
error: cannot find symbol
     [ujavac]     AnnotationTree annotationTree = (AnnotationTree) 
path.getLeaf();
     [ujavac]                                      ^
     [ujavac]   symbol:   class AnnotationTree
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:76: 
error: cannot find symbol
     [ujavac]     AssignmentTree assignTree =
     [ujavac]     ^
     [ujavac]   symbol:   class AssignmentTree
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:77: 
error: cannot find symbol
     [ujavac]         (AssignmentTree) annotationTree.getArguments().get(0);
     [ujavac]          ^
     [ujavac]   symbol:   class AssignmentTree
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:78: 
error: cannot find symbol
     [ujavac]     ExpressionTree exprTree = assignTree.getExpression();
     [ujavac]     ^
     [ujavac]   symbol:   class ExpressionTree
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:81: 
error: cannot find symbol
     [ujavac]     if (exprTree.getKind() == Kind.STRING_LITERAL) {
     [ujavac]                               ^
     [ujavac]   symbol:   variable Kind
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:85: 
error: cannot find symbol
     [ujavac]       NewArrayTree valuesTree = (NewArrayTree) exprTree;
     [ujavac]       ^
     [ujavac]   symbol:   class NewArrayTree
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:85: 
error: cannot find symbol
     [ujavac]       NewArrayTree valuesTree = (NewArrayTree) exprTree;
     [ujavac]                                  ^
     [ujavac]   symbol:   class NewArrayTree
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:86: 
error: cannot find symbol
     [ujavac]       for (ExpressionTree valueTree : 
valuesTree.getInitializers()) {
     [ujavac]            ^
     [ujavac]   symbol:   class ExpressionTree
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:106: 
error: cannot find symbol
     [ujavac]     Trees treeUtils = Trees.instance(processingEnv);
     [ujavac]     ^
     [ujavac]   symbol:   class Trees
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:106: 
error: cannot find symbol
     [ujavac]     Trees treeUtils = Trees.instance(processingEnv);
     [ujavac]                       ^
     [ujavac]   symbol:   variable Trees
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:111: 
error: cannot find symbol
     [ujavac]     TreePath path = treeUtils.getPath(element);
     [ujavac]     ^
     [ujavac]   symbol:   class TreePath
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:116: 
error: cannot find symbol
     [ujavac]     CompilationUnitTree unitTree = path.getCompilationUnit();
     [ujavac]     ^
     [ujavac]   symbol:   class CompilationUnitTree
     [ujavac]   location: class JavacUtils
     [ujavac] cofoja/src/com/google/java/contract/core/apt/JavacUtils.java:119: 
error: cannot find symbol
     [ujavac]     for (ImportTree importTree : unitTree.getImports()) {
     [ujavac]          ^
     [ujavac]   symbol:   class ImportTree
     [ujavac]   location: class JavacUtils
     [ujavac] Note: 
cofoja/src/com/google/java/contract/core/agent/ContractFixingClassAdapter.java 
uses or overrides a deprecated API.
     [ujavac] Note: Recompile with -Xlint:deprecation for details.
     [ujavac] Note: cofoja/src/com/google/java/contract/util/Predicates.java 
uses unchecked or unsafe operations.
     [ujavac] Note: Recompile with -Xlint:unchecked for details.
     [ujavac] 31 errors

Reply via email to