On Sat, Aug 28, 2010 at 06:40:10AM -0500, Phil Crow wrote:
>    I've finished numeric and string constant handling through to generation. 
> To activate the feature add
>    -verbose to your -javapopts. Without that you get the old ... behavior 
> regardless of constant type.

Excellent! It's great to see the constant values in the generated perl6
code.

I've committed the patch plus a few followups:
http://github.com/timbunce/java2perl6/commits/master

I hit a couple of problems with the parser that I worked around:
http://github.com/timbunce/java2perl6/commit/31c4259ba3d00e3a810e394c90caebbc3335eb17
but then I hit a similar one (with 'Code: ...') and realised there
might be a deeper problem here if the output of your javap -v isn't
the same as mine.

I've tweaked t/00_load.t to report the java version. Mine says:
    # java version "1.6.0_20"
    # Java(TM) SE Runtime Environment (build 1.6.0_20-b02-279-10M3065)
    # Java HotSpot(TM) Client VM (build 16.3-b01-279, mixed mode)
What does yours say? And what OS are you developing on?

I've left the code with javap -v enabled and t/03_class.t and t/55_final.t
failing. They now dump the javap output if the parse fails. The start of
the output for t/03_class.t on my system looks like this:

---snip---
Compiled from "FinalClassTest.java"
public final class FinalClassTest extends java.lang.Object
  SourceFile: "FinalClassTest.java"
  minor version: 0
  major version: 49
  Constant pool:
const #1 = Method       #4.#13; //  java/lang/Object."<init>":()V
const #2 = String       #14;    //   
const #3 = class        #15;    //  FinalClassTest
const #4 = class        #16;    //  java/lang/Object
const #5 = Asciz        <init>;
const #6 = Asciz        ()V;
const #7 = Asciz        Code;
const #8 = Asciz        LineNumberTable;
const #9 = Asciz        openStream;
const #10 = Asciz       ()Ljava/lang/String;;
const #11 = Asciz       SourceFile;
const #12 = Asciz       FinalClassTest.java;
const #13 = NameAndType #5:#6;//  "<init>":()V
const #14 = Asciz        ;
const #15 = Asciz       FinalClassTest;
const #16 = Asciz       java/lang/Object;

{
public FinalClassTest();
  Code:
   Stack=1, Locals=1, Args_size=1
   0:   aload_0
   1:   invokespecial   #1; //Method java/lang/Object."<init>":()V
   4:   return
  LineNumberTable: 
   line 1: 0

---snip---

It's seems like the Code block trips it up.

(I don't know why "javap -classpath testjavas -v FinalClassTest" includes
"Code: ..." but "javap -classpath testjavas -v java.sql.PreparedStatement"
doesn't. I presume it's related to java.sql.PreparedStatement being a
class bundled with the system.)

Could you "git pull" the current code and teach the parser what it needs
to know?

Thanks Phil!

Tim.

Reply via email to