ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "td.com" <lydie.comp...@td.com>
Subject Re: AW: java bytecode produced by "Ant javac" different from "command line javac" bytecode
Date Mon, 23 Nov 2009 15:18:51 GMT

Allow me to be more specific in what I think is strange in the decompiled
bytecode.

Say we have a test class as follows:

/*
  Class to test different javac options
*/
import java.io.File;
import java.io.IOException;

class Hello {
   public static void main(String[] a) {
   	 System.out.println("Hello world!"); 
   	(new Hello()).throwingAnException();
   }//end of main method
   
   public void throwingAnException(){
   	String filename = "FileGeneratedByHello.java.txt";
    try {
        // Create the file
        new File(filename).createNewFile();
    } catch (IOException e) {
        // Print out the exception that occurred
        //System.out.println("Unable to create "+filename+":
"+e.getMessage());
        throw new RuntimeException("Unable to create "+filename+":
"+e.getMessage());
    }
    finally{
    	System.out.println("Done...");
    	}
   }//end of throwingAnException
   
}//end of class Hello

when decompiled (using "jd-gui.exe"), the result is as follows:
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;

class Hello
{
  public static void main(String[] paramArrayOfString)
  {
    System.out.println("Hello world!");
    new Hello().throwingAnException();
  }

  public void throwingAnException() {
    String str = "FileGeneratedByHello.java.txt";
    try
    {
      new File(str).createNewFile();
    }
    catch (IOException localIOException)
    {
    }
    finally
    {
      System.out.println("Done...");
    }
  }
}

Is there something particular to javac that makes the throw in the catch
block "disappear" once the bytecode is decompiled?


td.com wrote:
> 
> Hello all!
> 
> The decompiler produces the exact same output every time (both for
> Ant-Javac and "command line"-Javac).... and the Ant-Javac output it always
> different from the "command-line"-Javac....
> 
>  


-- 
View this message in context: http://old.nabble.com/java-bytecode-produced-by-%22Ant-javac%22-different-from-%22command-line-javac%22-bytecode-tp26443538p26479926.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message