Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-dev] Java 7 Features in Eclipse

> However, Eclipse doesn't compile the following piece of code.
This doesn't really tell me what the error is.
Did you set the compliance, source and target platform to be 1.7.

> public class TryTypeAnnotation {
>     void m(@NonNull TryTypeAnnotation v) {
>     }
> }
You need to make sure that the type annotation NonNull is on the 
classpath.

> I wonder if there are any predefined sets of type annotations such as 
@NonNull that I 
> can try. I couldn't find any by browsing the source code of jdt.core. I 
also looked for 
> tests hoping that I'd find examples of pieces of JSR 308 code that the 
eclipse compiler 
> accepts. But, I didn't find any tests in the plugin that I exported.
JDT/Core doesn't provide such annotations. They must come from the 
libraries on the classpath.

> I'd appreciate it if you could point me to some sample JSR 308 codes 
that this 
> particular branch of the jdt.core accepts.
You can check the two test classes:
/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java
/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java

You need to grab them from the JSR_308 branch.
They contain lots of examples of the syntax accepted by the compiler.

It would probably be a good idea to continue this thread either on the jdt 
newsgroup or directly through emails.
This is not the kind of discussion that feets well on the eclipse-dev 
mailing list.

Let me know if you have other questions.

Olivier


Back to the top