Community
Participate
Working Groups
build 20040518 1) create X.java, Z.java and Z.java package q; import p.Y; import a.Z; /** * @ see Y */ public class X { void foo(){ new Y().foo(); } } package p; public class Y { /** * @deprecated */ public void foo() {} } package a; public class Z { } 2) create and execute the following ant script <?xml version="1.0" encoding="UTF-8"?> <project name="compile" default="main" basedir="../."> <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> <property name="root" value="${basedir}/P/src"/> <property name="destdir" value="${basedir}/P/bin2" /> <target name="main"> <javac srcdir="${root}" destdir="${destdir}" nowarn="off" deprecation="on" source="1.3" debug="off" verbose="off"> <compilerarg line="-enableJavadoc"/> </javac> </target> </project> The result is [javac] ---------- [javac] 1. WARNING in D:\atest\eclipse-SDK-I20040518-win32\target0 \P\src\q\X.java (at line 11) [javac] new Y().foo(); [javac] ^^^^^^^^^^^^^ [javac] The method foo() from the type Y is deprecated [javac] ---------- [javac] 1 problem (1 warning) If deprecation="off" the result is [javac] ---------- [javac] 1. WARNING in D:\atest\eclipse-SDK-I20040518-win32\target0 \P\src\q\X.java (at line 4) [javac] import a.Z; [javac] ^^^ [javac] The import a.Z is never used [javac] ---------- [javac] 1 problem (1 warning)
The unused import warning should still be reported if deprecation is on.
Created attachment 10837 [details] Replace the file jdtCompilerAdapter.jar in the jdt.core plugin with this one
Created attachment 10838 [details] Here is the source patch for apply on HEAD
With this patch that works as i supposed at the beginning. [javac] ---------- [javac] 1. WARNING in D:\atest\eclipse-SDK-I20040518-win32\target0 \P\src\q\X.java (at line 4) [javac] import a.Z; [javac] ^^^ [javac] The import a.Z is never used [javac] ---------- [javac] ---------- [javac] 2. WARNING in D:\atest\eclipse-SDK-I20040518-win32\target0 \P\src\q\X.java (at line 11) [javac] new Y().foo(); [javac] ^^^^^^^^^^^^^ [javac] The method foo() from the type Y is deprecated [javac] ---------- [javac] 2 problems (2 warnings)
Created attachment 10844 [details] new patch that improves the ant adapter if the compilerarg is empty Apply on HEAD. The previous patch needs to be removed first. I will attach the corresponding jar later.
Created attachment 10845 [details] Use this new jar
Fixed and released in HEAD.
Verified in 200405281200