typetools/annotation-tools

AFU asserts when attempting to insert annotations from JuliaSoft-provided JAIF into Jetty-Server sources

GoogleCodeExporter opened this issue · 5 comments

What steps will reproduce the problem?
1. Log in to buffalo.cs.washington.edu
2. cd 
/scratch/secs-jenkins/bug_repros/afu_insertion_bugs/jetty.project-jetty-9.2.6.v2
0141205/jetty-server
3. ./repro

What is the expected output?

The annotations in jetty-server.jaif are inserted into the sources under 'src'

What do you see instead?

Exception in thread "main" java.lang.AssertionError: annotation tree hasn't 
been attributed yet: @ManagedObject("AbstractNetworkConnector")
    at com.sun.tools.javac.util.Assert.error(Assert.java:133)
    at com.sun.tools.javac.util.Assert.checkNonNull(Assert.java:118)
    at com.sun.tools.javac.comp.Check.validateTypeAnnotation(Check.java:2745)
    at com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitAnnotation(Attr.java:4452)
    at com.sun.tools.javac.tree.JCTree$JCAnnotation.accept(JCTree.java:2317)
    at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
    at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
    at com.sun.tools.javac.tree.TreeScanner.visitModifiers(TreeScanner.java:315)
    at com.sun.tools.javac.tree.JCTree$JCModifiers.accept(JCTree.java:2343)
    at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
    at com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitClassDef(Attr.java:4534)
    at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
    at com.sun.tools.javac.comp.Attr.validateTypeAnnotations(Attr.java:4441)
    at com.sun.tools.javac.code.TypeAnnotations$2.run(TypeAnnotations.java:142)
    at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:155)
    at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:129)
    at com.sun.tools.javac.comp.Enter.complete(Enter.java:512)
    at com.sun.tools.javac.comp.Enter.main(Enter.java:471)
    at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:982)
    at com.sun.tools.javac.api.JavacTaskImpl.enter(JavacTaskImpl.java:316)
    at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:359)
    at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:344)
    at annotator.Source.parse(Source.java:120)
    at annotator.Main.main(Main.java:755)

Original issue reported on code.google.com by jtha...@cs.washington.edu on 12 May 2015 at 12:11

The source of the problem appears to be in javac rather than AFU.  Note that 
the AFU line at which the exception is thrown is simply "task.analyze();", 
where task is the result of a call to getTask() on the system compiler.  (The 
line is within a try/catch, but apparently there is a forced exit somewhere in 
between.)

Original comment by d...@cs.washington.edu on 12 May 2015 at 7:45

  • Changed state: Invalid
I'm a bit confused by the response to the bug report.  If a user can call the 
AFU, and the AFU crashes, then isn't that by definition an AFU bug?  If there 
is invalid input that is being passed to javac, then I think that the AFU 
should be detecting that somehow and issuing a user-friendly report.  The AFU 
should never show a stack trace.

If the bug is truly in javac, then could you isolate that in a bug report so 
that we can get javac fixed?  Even in that case, indicating to the user that 
javac crashed, and on what files, is needed so that the user knows what to do.

Original comment by michael.ernst@gmail.com on 12 May 2015 at 9:29

I can't catch the exception, presumably because another handler (in the javac 
codebase) is catching it and forcing the program to exit.  I will investigate 
the javac issue a bit further and submit a report.

Original comment by d...@cs.washington.edu on 12 May 2015 at 9:51

Okay, silly oversight on my part: AssertionError wasn't caught because 
annotator.Source handled only Exceptions from task.analyze().  The new version 
catches all Throwables.  The source of the problem was simply a missing class 
file: "com.sun.tools.javac.code.Symbol$CompletionFailure: class file for 
org.eclipse.jetty.util.component.LifeCycle not found"

Original comment by d...@cs.washington.edu on 31 May 2015 at 11:09

  • Changed state: Pushed

Original comment by Jonathan...@gmail.com on 1 Jun 2015 at 11:26

  • Changed state: Fixed