Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn only when necessary for "IndexFileSpecification did not find classfile" #34

Open
GoogleCodeExporter opened this issue Jul 3, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

When running insert-annotations-to-source, if a class file corresponding to a 
.java file cannot be found, the following warning is issued:

  Warning: IndexFileSpecification did not find classfile for:  mypackage.MyClass

This warning is harmless if you are only inserting annotations on signatures.  
The tool should only issue the warning when it is really a problem, not every 
time that a class cannot be found.

Original issue reported on code.google.com by [email protected] on 16 Apr 2013 at 6:06

@GoogleCodeExporter
Copy link
Author

Original comment by [email protected] on 16 Apr 2013 at 6:38

  • Changed state: Accepted
  • Added labels: Priority-Low, Type-Enhancement
  • Removed labels: Priority-Medium, Type-Defect

@GoogleCodeExporter
Copy link
Author

Failing to find class files can currently cause incorrect insertions. This 
example has a class on one java file reference a static nested class from 
another java file.

TestStatic.java:
class TestStatic {
    void test() {
        Other.MyClass myLocal = new Other.MyClass();
    }
}

TestOther.java:
class Other {
    static class MyClass { }

}

insert-annotations-to-source -v -d ./output ./output/inference.jaif 
/Users/mcarthur/dev/dff_2/verigames/java/dist/scripts/TestStatic.java 
/Users/mcarthur/dev/dff_2/verigames/java/dist/scripts/TestOther.java
Using classpath: /Users/mcarthur/dev/dff_2/verigames/java/dist
Warning: IndexFileSpecification did not find classfile for: Other
Warning: IndexFileSpecification did not find classfile for: TestStatic
Warning: IndexFileSpecification did not find classfile for: Other$MyClass
Read 9 annotations from ./output/inference.jaif
Processing /Users/mcarthur/dev/dff_2/verigames/java/dist/scripts/TestStatic.java
Parsed /Users/mcarthur/dev/dff_2/verigames/java/dist/scripts/TestStatic.java
Found class TestStatic, but unable to insert @ostrusted.quals.OsUntrusted:
  @ostrusted.quals.OsUntrusted (nl=true) @ [GenericArrayLocationCriterion at outermost type, ExtImplsLocationCriterion: class TestStatic at type index: -1, In class 'TestStatic' (exactly), In class 'TestStatic' (exactly)]
getPositions returned 3 positions in tree for 
/Users/mcarthur/dev/dff_2/verigames/java/dist/scripts/TestStatic.java
...
Writing ./output/TestStatic.java
Processing /Users/mcarthur/dev/dff_2/verigames/java/dist/scripts/TestOther.java
Parsed /Users/mcarthur/dev/dff_2/verigames/java/dist/scripts/TestOther.java
Found class Other, but unable to insert @ostrusted.quals.OsUntrusted:
  @ostrusted.quals.OsUntrusted (nl=true) @ [GenericArrayLocationCriterion at outermost type, ExtImplsLocationCriterion: class Other at type index: -1, In class 'Other' (exactly), In class 'Other' (exactly)]
getPositions returned 0 positions in tree for 
/Users/mcarthur/dev/dff_2/verigames/java/dist/scripts/TestOther.java
Writing ./output/TestOther.java

output/TestStatic.java:
import ostrusted.quals.OsUntrusted;
class TestStatic {
    void test(@OsUntrusted TestStatic this) {
        @OsUntrusted
        Other.MyClass myLocal = new @OsUntrusted Other.MyClass();
    }
}

We could make the warning's more prominent and also state that this might cause 
incorrect insertions, or warn only when we encounter an insertion that can't be 
performed correctly without the class files. (Or change insertions on static 
nested classes to not need the class files, but I don't know if that is 
possible or that it is the only case that requires class files).

-David

Original comment by [email protected] on 25 Nov 2013 at 6:36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants