Bug 62952 - Ant adapter behavior is a little strange
Summary: Ant adapter behavior is a little strange
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 RC1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-19 11:17 EDT by David Audel CLA
Modified: 2004-05-28 15:41 EDT (History)
0 users

See Also:


Attachments
Replace the file jdtCompilerAdapter.jar in the jdt.core plugin with this one (8.99 KB, application/octet-stream)
2004-05-19 11:20 EDT, Olivier Thomann CLA
no flags Details
Here is the source patch for apply on HEAD (725 bytes, patch)
2004-05-19 11:26 EDT, Olivier Thomann CLA
no flags Details | Diff
new patch that improves the ant adapter if the compilerarg is empty (1.06 KB, patch)
2004-05-19 11:50 EDT, Olivier Thomann CLA
no flags Details | Diff
Use this new jar (9.00 KB, application/octet-stream)
2004-05-19 11:51 EDT, Olivier Thomann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Audel CLA 2004-05-19 11:17:58 EDT
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)
Comment 1 Olivier Thomann CLA 2004-05-19 11:19:23 EDT
The unused import warning should still be reported if deprecation is on.
Comment 2 Olivier Thomann CLA 2004-05-19 11:20:11 EDT
Created attachment 10837 [details]
Replace the file jdtCompilerAdapter.jar in the jdt.core plugin with this one
Comment 3 Olivier Thomann CLA 2004-05-19 11:26:45 EDT
Created attachment 10838 [details]
Here is the source patch for apply on HEAD
Comment 4 David Audel CLA 2004-05-19 11:28:58 EDT
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)
Comment 5 Olivier Thomann CLA 2004-05-19 11:50:06 EDT
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.
Comment 6 Olivier Thomann CLA 2004-05-19 11:51:28 EDT
Created attachment 10845 [details]
Use this new jar
Comment 7 Olivier Thomann CLA 2004-05-25 09:36:18 EDT
Fixed and released in HEAD.
Comment 8 Olivier Thomann CLA 2004-05-28 15:41:00 EDT
Verified in 200405281200