Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate Class Error when using vaadin (which contains java-files) #10108

Closed
scabug opened this issue Dec 16, 2016 · 2 comments
Closed

Duplicate Class Error when using vaadin (which contains java-files) #10108

scabug opened this issue Dec 16, 2016 · 2 comments

Comments

@scabug
Copy link

scabug commented Dec 16, 2016

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.

When I remove the java files in the vaadin-server jar file, it works. When I only use java (no scala) it is also no problem, that java files are contained in the jar side to side with the class files.

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

@scabug
Copy link
Author

scabug commented Dec 16, 2016

Imported From: https://issues.scala-lang.org/browse/SI-10108?orig=1
Reporter: Guenther Grill (guenther)
Affected Versions: 2.11.8
Attachments:

  • demo.zip (created on Dec 16, 2016 9:32:42 AM UTC, 131492 bytes)

@scabug
Copy link
Author

scabug commented Dec 20, 2016

@lrytz said:
"Please remove or make sure it appears in the correct subdirectory of the sourcepath" sounds like gradle / zinc is passing /Users/ggr/.gradle/caches/modules-2/files-2.1/com.vaadin/vaadin-server/7.7.5/28bc909336b9b399d93926b99148ce66d1bf3ed3/vaadin-server-7.7.5.jar as -sourcepath.

Also, the error ("bad source file") seems to come from the Java compiler, not the Scala compiler. So it seems not to be a bug on our end.

@scabug scabug closed this as completed Dec 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant