javac abort with enum having annotation in constructor, aspectj

Fabian Kessler fabian.kessler at optimaize.com
Thu Jul 25 07:46:35 PDT 2013


symptom: javac just aborts without error/success.
environment: windows 7 64bit java 7 u25 (and 21)
reproducible: yes, on 2 of my machines, i don't have a small test case.

description:
i'm running javac command line
javac @argfile @filelist
the important parts of the argfile are:
-d
-classpath (long)
-sourcepath
-s
-g
-target 1.6 -source 1.6 -encoding UTF-8 -verbose
(i got this from maven)

the argfile lists all java files to compile.

this works for all of my modules of a maven multi-module project, except
for one.
on that one, the result is that javac just aborts after some "[lading
ZipFileIndexFileObject...] lines.
no classes are generated at all.

i've isolated it to one enum. this one fails:

public enum MyEnum {
    FOO(true);
    private MyEnum(@NotNull Boolean b) {
    }
}

this one works:

public enum MyEnum {
    FOO(true);
    private MyEnum(Boolean b) {
    }
    private void foo(@NotNull Boolean b) {
        System.out.println(b);
    }
}

my failing module uses plain java (source and target 1.6 as stated above).
the MyEnum class comes from another module (which compiles successfully)
also using source and target 1.6, but also has aspectj in it:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-idea-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <downloadSources>true</downloadSources>
                    <dependenciesAsLibraries>true</dependenciesAsLibraries>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <version>1.2</version>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjrt</artifactId>
                        <version>1.6.12</version>
                    </dependency>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjtools</artifactId>
                        <version>1.6.12</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <outxml>true</outxml>
                    <aspectLibraries>
                        <aspectLibrary>
                            <groupId>org.springframework</groupId>
                            <artifactId>spring-aspects</artifactId>
                        </aspectLibrary>
                        <aspectLibrary>
                            <groupId>org.springframework.data</groupId>
                            <artifactId>spring-data-neo4j</artifactId>
                        </aspectLibrary>
                    </aspectLibraries>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

so the workaround for me is to not use [that] annotation there.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20130725/c35660c1/attachment.html 


More information about the compiler-dev mailing list