Yeah. I think this is actually an issue where Eclipse can magically handle this but not javac. Upon further investigation javac fails with the same error. Sorry for wasting anyone's time.
--Rudy -----Original Message----- From: Rémy Sanlaville [mailto:[EMAIL PROTECTED] Sent: Thursday, September 07, 2006 10:31 AM To: Maven Users List Subject: Re: Maven compile error mystery It seems that you used java 1.5. Do you specify it in your pom ? <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> 2006/9/7, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > Hey guys, > > > > For some reason I'm getting a compile error from Maven for this code > that compiles fine in eclipse, with javac, and with ant. Maven is the > only thing that reports this error. > > Anyone have any ideas? > > > > Here is the error: > > [INFO] > ------------------------------------------------------------------------ > > [ERROR] BUILD FAILURE > > [INFO] > ------------------------------------------------------------------------ > > [INFO] Compilation failure > > > > C:\eclipse_workspace\Medical Litigator - > Common\src\main\java\com\thomson\west\medlit\util\CollectionUtils.java:[ > 70,34] incompatible types > > found : java.lang.Object[][] > > required: T[][] > > > > C:\eclipse_workspace\Medical Litigator - > Common\src\main\java\com\thomson\west\medlit\util\CollectionUtils.java:[ > 145,34] incompatible types > > found : java.lang.Object[][] > > required: T[][] > > > > > > [INFO] > ------------------------------------------------------------------------ > > [DEBUG] Trace > > org.apache.maven.BuildFailureException: Compilation failure > > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Default > LifecycleExecutor.java:555) > > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifec > ycle(DefaultLifecycleExecutor.java:475) > > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultL > ifecycleExecutor.java:454) > > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandle > Failures(DefaultLifecycleExecutor.java:306) > > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments( > DefaultLifecycleExecutor.java:273) > > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifec > ycleExecutor.java:140) > > at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322) > > at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115) > > at org.apache.maven.cli.MavenCli.main(MavenCli.java:256) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav > a:39) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor > Impl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:585) > > at > org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) > > at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) > > at > org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) > > at org.codehaus.classworlds.Launcher.main(Launcher.java:375) > > Caused by: org.apache.maven.plugin.CompilationFailureException: > Compilation failure > > at > org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMoj > o.java:505) > > at > org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:111) > > at > org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginMa > nager.java:412) > > at > org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Default > LifecycleExecutor.java:534) > > ... 16 more > > > > Here is a snippet of the code that is causing it: > > > > public static <T> T[][] splitTypedArray( T[] originalArray, int > arraySize ) { > > return cast2DArray( originalArray.getClass(), > splitArray(originalArray, arraySize) ); > > } > > > > public static <T> T[][] cast2DArray(Class<? extends T[]> clazz, > Object[][] array ) > > throws ClassCastException { > > //this is safe( since we are giving T.class to > Array.newInstance. > > //the problem is that Array.newInstance() is not genericized > as it should be. > > T[][] newArray = (T[][])Array.newInstance( clazz, > array.length ); > > for(int i=0; i<array.length; i++ ) > > //cast each sub-array and add it to our new array. > > newArray[i] = clazz.cast( array[i] ); > > > > return newArray; > > } > > } > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
