barry-m / checker-framework

Automatically exported from code.google.com/p/checker-framework
Other
0 stars 0 forks source link

Maven/Eclipse plug-ins need better handling of javac error messages #227

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Obtain Google Guava by running

git clone https://code.google.com/p/guava-libraries/

Apply the attached diff.

Run the Interning Checker, via

mvn checkers:check

The Checker Framework issues the attached errors, but it should type-check 
cleanly other than warnings about uses of ==.

Original issue reported on code.google.com by michael.ernst@gmail.com on 4 Jun 2013 at 8:28

Attachments:

GoogleCodeExporter commented 9 years ago
I have tinkered with this quite a bit today.   When you use -source 1.6 with 
the Checker Framework does this disable part of the frameworks functionality 
since 1.6 doesn't support type annotations?  Because if you use no checker and 
-source.6 then all of the errors in cf-output.txt EXCEPT for one (shown below) 
disappear. 

Remaining Errors:
/homes/gws/mernst/research/types/guava-libraries-cf/guava/src/com/google/common/
reflect/Types.java:[317,23] TypeVariableImpl is not abstract and does not 
override abstract method getDeclaredAnnotations() in AnnotatedElement

You may want to use the Checker Framework compiler in place of the one Maven 
uses by default ( as Werner asked about in an email).  To do so, edit the top 
level pom.xml (found in  the top-level of the gava repository).  Find a section 
like the following and add the executable element shown below: 

          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.3.2</version>
          <configuration>
           <source>1.6</source> 
           <target>1.6</target>
           <executable>path_to_javac</executable>
          </configuration>
        </plugin>

This still leads to the 1 error I mentioned above and 6 if you take away the 
-source 1.6.

Original comment by jbu...@cs.washington.edu on 1 Jul 2013 at 3:44

GoogleCodeExporter commented 9 years ago
Java 8 adds extra methods to AnnotatedElement; 
com/google/common/reflect/Types.java implements AnnotatedElement for class 
TypeVariableImpl, but obviously doesn't implement the new methods. Even when 
you compile with source 1.6 you see the additional methods we provide in the 
jsr308-langtools JDK changes.
So Guava correctly compiles with Java 1.6.

But as you note, using -source 1.6 turns off the changed checks from Java 8.
I suspect that many of the errors in the initial bug report come from the 
changed Java 8 checks, not from the type processors.
Jonathan, can you attach a diff to cf-output when no processor is run?

Original comment by wdi...@gmail.com on 1 Jul 2013 at 9:29

GoogleCodeExporter commented 9 years ago
I have attached two diffs between cf-output and when I use no checkers.  One 
has -source 1.6 specified and one does not.

Original comment by jbu...@cs.washington.edu on 3 Jul 2013 at 5:14

Attachments:

GoogleCodeExporter commented 9 years ago
I find these diffs hard to read.  I have two suggestions for improving them.

1. Before diffing, remove all occurrences of 
"/homes/gws/mernst/research/types/guava-libraries-cf" and 
"/Users/jburke/Documents/projects/guava/guava-libraries" from both files.  That 
will eliminate large numbers of extraneous differences.

2. Use context diffs; that is, run "diff -c" or, better, "diff -u".  This puts 
the differences in context and also shows the names of the files being compared.

Thanks!

Original comment by michael.ernst@gmail.com on 3 Jul 2013 at 5:26

GoogleCodeExporter commented 9 years ago
So there seems to be no appreciable difference between 1.6/1.8 when I ran it 
again recently so I have attached a diff between cf-output.txt (that Mike 
posted) with a version run with no checkers using the latest Eclipse plugin.  I 
have cleaned it up per Mike's instructions.

Original comment by Jonathan...@gmail.com on 21 Aug 2013 at 5:41

Attachments:

GoogleCodeExporter commented 9 years ago
The diffs are bigger than before, not smaller!  Now there are a lot of 
gratuitous differences because one file has "guava-libraries-cf/" and the other 
has "guava-libraries/".  Either change "guava-libraries-cf/" to 
"guava-libraries/", or change "guava-libraries/" to "guava-libraries-cf/".  Or 
post the output itself so that someone else can make a proper, comprehensible 
diff.

Original comment by michael.ernst@gmail.com on 21 Aug 2013 at 7:07

GoogleCodeExporter commented 9 years ago

Original comment by Jonathan...@gmail.com on 21 Aug 2013 at 7:23

Attachments:

GoogleCodeExporter commented 9 years ago
The diff has been attached above.  

Original comment by Jonathan...@gmail.com on 21 Aug 2013 at 7:24

GoogleCodeExporter commented 9 years ago
(You attached the actual output, not the diff.  But thanks, that is helpful.)
I've now attached a diff that tries to elide irrelevant details.

My original problem reported that there were unexpected errors regarding the 
processing of Guava under the Checker Framework.  Some of these are generics 
bugs and some may have to do with the Maven plugin itself.

Jonathan's current output suggests that these problems still exist (though in a 
few cases the error messages are now cleaner).  So, the original problems 
remain, though maybe they should be separated into different bug reports 
depending on the root cause of each one.

Jonathan, you said in comment #5 "using the latest Eclipse plugin".  I think 
you meant the latest Maven plugin.

Original comment by michael.ernst@gmail.com on 21 Aug 2013 at 7:50

Attachments:

GoogleCodeExporter commented 9 years ago
All errors in the last diff are either from javac or the Maven plug-in.
The javac problems need to be fixed in the Guava source code itself, e.g. by 
not using a type annotation on a scoping construct.
The Maven plug-in needs to correctly handle javac error messages. Similar 
parsing is needed in the Eclipse plug-in.

Original comment by wdi...@gmail.com on 27 Aug 2013 at 5:42

GoogleCodeExporter commented 9 years ago

Original comment by mer...@cs.washington.edu on 21 Nov 2013 at 8:26