Bug 289631 - [ant][compiler] Batch compiler show warnings, that not show in IDE
Summary: [ant][compiler] Batch compiler show warnings, that not show in IDE
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-16 12:44 EDT by Alexey Kuznetsov CLA
Modified: 2009-10-27 07:29 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Kuznetsov CLA 2009-09-16 12:44:45 EDT
User-Agent:       Opera/9.80 (Windows NT 5.1; U; ru) Presto/2.2.15 Version/10.00
Build Identifier: M20090911-1628

when I run ecj-3.5.1RC4.jar from ant it shows several warnings: [unchecked] unchecked cast that are not highlited by compler when I work in IDE

Reproducible: Always

Steps to Reproduce:
I have this code. In IDE - no warnings.

private JComponent addListActiveProperty(DomainProperty property, String layout)
{
 IListView<?> listView = lvFactory.create(property.dataType());
 if (listView != null)
 {
  listView.setName(property.name());
  listView.setTitle(property.displayName());
  JComponent result = (JComponent) listView;

  this.add(result, StringUtils.coalesce(layout, "span, push, grow"));
  return (result);
 }
  
  return (null);
}

When run ecj-3.5.1RC4.jar from ant (run ant script inside IDE, but with Separate JRE option) I have following warnings:

    [javac] Note: C:\Temp\deploy\src\ka\presentation\builder\impl\DomainPanelBuilder.java uses unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.

and after adding -Xlint:unchecked to javac comand I have this:

    [javac] C:\Temp\deploy\src\ka\presentation\builder\impl\DomainPanelBuilder.java:222: warning: [unchecked] unchecked cast
    [javac] found   : ka.ui.intf.IListView<capture#914 of ?>
    [javac] required: javax.swing.JComponent
    [javac]    JComponent result = (JComponent) listView;
    [javac]                                     ^
    [javac] C:\Temp\deploy\src\ka\presentation\builder\impl\DomainPanelBuilder.java:348: warning: [unchecked] unchecked cast
    [javac] found   : ka.ui.intf.IListView<capture#375 of ?>
    [javac] required: javax.swing.JComponent
    [javac]   this.add((JComponent)listView, StringUtils.coalesce(layout, "span, push, grow"));
    [javac]                        ^
    [javac] C:\Temp\deploy\src\ka\presentation\builder\impl\DomainPanelBuilder.java:349: warning: [unchecked] unchecked cast
    [javac] found   : ka.ui.intf.IListView<capture#824 of ?>
    [javac] required: javax.swing.JComponent
    [javac]   return ((JComponent)listView);
    [javac]                       ^
    [javac] 3 warnings

Why it happens? As I understand in both cases used internal eclipse compiler.
Comment 1 Olivier Thomann CLA 2009-09-16 12:59:09 EDT
You are not running our compiler inside your ant script.
Do you have this line in your ant script ?
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter" />
The ouput that you give looks like javac warning output, not the Eclipse compiler output.
Comment 2 Olivier Thomann CLA 2009-09-16 14:48:54 EDT
Closing as INVALID.
Reopen if you still have a problem once the Eclipse compiler is used inside the ant javac task.
Comment 3 Alexey Kuznetsov CLA 2009-09-17 01:43:56 EDT
Very strange...
When I remove  [compiler="modern"] from <javac> command all works fine.
It seems that some how ant compile my classes by JDK6 compiler. But I don't configure JAVA_HOME to JDK6.
It seems that because of I configure tools.jar in Ant-runtime-global entries to D:\JDK\j2sdk1.6_16\lib\tools.jar, ant is able to find JDK javac compiler and use it not regarding of
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"
/>

I also configure Ant-runtime-global entries: add exteranl jar: ecj-3.5.1RC4.jar

now all works fine, but Is such behavior expected (compiler="modern")?
Comment 4 Olivier Thomann CLA 2009-09-17 07:51:52 EDT
compiler=modern, this is javac, not the Eclipse compiler.
You should report this against Ant and not JDT.
Closing as INVALID.
Comment 5 Jay Arthanareeswaran CLA 2009-10-27 04:57:48 EDT
Verified for 3.6 M3