vaadin / framework

Vaadin 6, 7, 8 is a Java framework for modern Java web applications.
http://vaadin.com/
Other
1.78k stars 729 forks source link

Duplicate Class Error when cross compiling scala and java #7937

Closed vaadin-bot closed 7 years ago

vaadin-bot commented 7 years ago

Originally by guenther


Hi,

when scala is cross compiling java files, I get an duplicate class error:

Executing org.gradle.api.internal.tasks.scala.ZincScalaCompiler@23c084bd in compiler daemon.
Compiling with Zinc Scala compiler.
Compiling 1 Java source to /Users/ggr/Downloads/demo/build/classes/main...
/Users/ggr/.gradle/caches/modules-2/files-2.1/com.vaadin/vaadin-server/7.7.5/28bc909336b9b399d93926b99148ce66d1bf3ed3/vaadin-server-7.7.5.jar(com/vaadin/annotations/JavaScript.java):58: error: duplicate class: com.vaadin.annotations.JavaScript
public @interface JavaScript {
        ^
/Users/ggr/.gradle/caches/modules-2/files-2.1/com.vaadin/vaadin-server/7.7.5/28bc909336b9b399d93926b99148ce66d1bf3ed3/vaadin-server-7.7.5.jar(com/vaadin/server/Page.java):36: error: cannot access JavaScript
import com.vaadin.ui.JavaScript;
                    ^
  bad source file: /Users/ggr/.gradle/caches/modules-2/files-2.1/com.vaadin/vaadin-server/7.7.5/28bc909336b9b399d93926b99148ce66d1bf3ed3/vaadin-server-7.7.5.jar(com/vaadin/ui/JavaScript.java)
    file does not contain class com.vaadin.ui.JavaScript
    Please remove or make sure it appears in the correct subdirectory of the sourcepath.
Exception executing org.gradle.api.internal.tasks.scala.ZincScalaCompiler@23c084bd in compiler daemon: org.gradle.api.internal.tasks.compile.CompilationFailedException: javac returned nonzero exit code.
:compileScala FAILED
:compileScala (Thread[main,5,main]) completed. Took 4.81 secs.

Demo to reproduce problem is attached. Just extract, go in and type ./gradlew clean testClasses --info


Imported from https://dev.vaadin.com/ issue #20484

vaadin-bot commented 7 years ago

Originally by guenther


Attachment added: demo.zip (128.4 KiB)

guenhter commented 7 years ago

I narrowed down the problem. The jar files (e.g. vaadin-server-7.7.5.jar) not only contains .class files, but also .java files. Is this really needed? Why is the source contained on the jar-file?

Legioth commented 7 years ago

The .java files are there for legacy reasons to support users that do not use maven or other similar dependency management systems.

tsuoanttila commented 7 years ago

@guenhter Can you test latest 7.7-SNAPSHOT? We made a fix that addressed at least some cases similar to this, but it has not made into any maintenance release yet.

guenhter commented 7 years ago

@tsuoanttila using the 7.7-SNAPSHOT really works. Do you have any idea, when this will be available in a maintenance release?

guenhter commented 7 years ago

Any updates on this?

Legioth commented 7 years ago

Any updates on this?

The plan right now is to release 7.7.7 next week.