Bug 923

Summary: Gluegen fails to build from source using JDK8 EA b119
Product: [JogAmp] Gluegen Reporter: Xerxes Rånby <xerxes>
Component: coreAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: ---    
Version: 2   
Hardware: All   
OS: all   
Type: --- SCM Refs:
1e53a38eb06aa8ff50660fdf7bd8570b27f27c56
Workaround: TRUE
Attachments: jdk-8-ea-bin-b119-linux-i586-05_dec_2013.gluegen.2.1.3.build.log

Description Xerxes Rånby 2013-12-13 09:50:18 CET
Created attachment 567 [details]
jdk-8-ea-bin-b119-linux-i586-05_dec_2013.gluegen.2.1.3.build.log

Gluegen fails to build from source using JDK8 EA b119
JDK8 Build b119 is available at:
https://jdk8.java.net/download.html


Gluegen succeeds to build using JDK7 7u60 Build b01
JDK7 7u60 Build b01 is available at:
https://jdk7.java.net/download.html

Gluegen succeeds to build using OpenJDK 7u25
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2)
http://packages.ubuntu.com/precise/openjdk-7-jdk

Gluegen succeeds to build using OpenJDK 6u27
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.4)
http://packages.ubuntu.com/precise/openjdk-6-jdk


Tested using gluegen git tag v2.1.3
OS: Ubuntu 12.04 LTS Linux 32bit.

+++

Steps to reproduce:
tar zxvf jdk-8-ea-bin-b119-linux-i586-05_dec_2013.tar.gz
git clone git://jogamp.org/srv/scm/gluegen.git
cd gluegen/make
JAVA_HOME=/home/xranby/jdk1.8.0/ ant

+++

JDK8 EA b119 Build Output:

java.build:
     [echo]  - - - compiling all java files - - -
     [echo]  test.base.dir ../src/junit
     [echo]  build_t.gen     ../build/test/build/gensrc
    [javac] Compiling 1 source file to /home/xranby/gluegen/build/test/build/classes
    [javac] CStruct: @com.jogamp.gluegen.structgen.CStruct(name=_default_, header=TestStruct01.h), package com.jogamp.gluegen.test.junit.structgen, header TestStruct01.h
    [javac] CStruct.0: user.dir: /home/xranby/gluegen/make
    [javac] generating struct accessor for struct: RenderingConfig
    [javac] CStruct.0: element: config0, .simpleName config0
    [javac] CStruct.0: enclElement: com.jogamp.gluegen.test.junit.structgen.TestStructGen01, .simpleName TestStructGen01, .package com.jogamp.gluegen.test.junit.structgen
    [javac] CStruct.locateSource.0: p com.jogamp.gluegen.test.junit.structgen, r TestStruct01.h
    [javac] Catched FileNotFoundException: com.jogamp.gluegen.test.junit.structgen/TestStruct01.h
    [javac] CStruct.locateSource.0: p , r TestStruct01.h
    [javac] CStruct.locateSource.1: h file:/home/xranby/gluegen/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStruct01.h
    [javac] CStruct: /home/xranby/gluegen/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStruct01.h, abs: true, root /home/xranby/gluegen/src/junit/..
    [javac] CStruct: OutputDir: ../build/test/build/gensrc/classes, is-abs false
    [javac] CStruct: OutputPath: /home/xranby/gluegen/src/junit/../../build/test/build/gensrc/classes
    [javac] CStruct: ConfigFile: /home/xranby/gluegen/src/junit/../../build/test/build/gensrc/classes/TestStruct01.h.cfg
    [javac] generating -> Camera
    [javac] generating -> Vec3f
    [javac] warning: Supported source version 'RELEASE_6' from annotation processor 'com.jogamp.gluegen.structgen.CStructAnnotationProcessor' less than -source '1.7'
    [javac] generating -> RenderingConfig
    [javac] /home/xranby/gluegen/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen01.java:4: error: package com.jogamp.junit.util does not exist
    [javac] import com.jogamp.junit.util.JunitTracer;
    [javac]                             ^
    [javac] /home/xranby/gluegen/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen01.java:13: error: cannot find symbol
    [javac] public class TestStructGen01 extends JunitTracer {
    [javac]                                      ^
    [javac]   symbol: class JunitTracer
    [javac] /home/xranby/gluegen/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen01.java:22: error: cannot find symbol
    [javac]     RenderingConfig config0;
    [javac]     ^
    [javac]   symbol:   class RenderingConfig
    [javac]   location: class TestStructGen01
    [javac] 3 errors
    [javac] 1 warning
Comment 1 Sven Gothel 2013-12-13 11:48:14 CET
A quick analysis reveals that the new annotation tool does not tolerate missing
dependencies of the processed java file anymore.

I.e. we run the annotation tool on a java file w/ dependencies
which are not yet generated and hence not resolvable in the classpath.

This has worked w/ Java7.
W/ Java6 and Java7, the annotation tool produced the new artifacts
despite the warning/error messages of unresolved symbols.
Then a later compilation process of ours produces the class files.

We will adapt to this behavioral change.
Comment 2 Sven Gothel 2014-05-11 03:10:38 CEST
Bug 923: Remove dependency of CStruct annotation processor _generation_ and generated_class_user due to Java8 issues.

Java8's annotation processor as embedded within javac does not allow
referencing not-yet existing generated classes in a class source code
which will produce these generated classes via the annotation process.

Example:

+++
import com.jogamp.gluegen.structgen.CStruct;

public class Lala {
  @CStruct(name="RenderingConfig", header="TestStruct01.h")
  public RenderingConfig config;
}
+++

Above example illustrates that the type 'RenderingConfig'
does not exist at time of processing the annotation.
The type will be created via the annotation process itself.

Even though we pass '-proc:only', i.e. skip java compilation,
Java8's annotation processing via javac fails in such case.

We see this as a bug within javac's annotation processing itself!

+++

This workaround splits the annotation process and using the class as
generated by the former.

To allow this to work, CStruct receives a new field 'jname'
allowing to enforce the java-name of the structure
using a dummy field type like boolean.

  @CStruct(name="RenderingConfig", jname="RenderingConfig",
           header="TestStruct01.h")
  public boolean dummy;

Further more CStruct can be annotated on the package, i.e. 'package-info.java',
avoiding the dependency problem altogether.
To support multiple header files and types,
'CStructs' has been introduced using an array of 'CStruct'.

  @CStructs({@CStruct(name="RenderingConfig", header="TestStruct01.h"),
             @CStruct(name="Pixel", header="TestStruct02.h")})
  package com.jogamp.gluegen.test.junit.structgen;

Tests:
  - Build w/ Java7 and Java8
  - Validated 'major version 50' (Java 6) class files (OK)