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

Scalac fails to parse Google Protobuf2.x generated Java file #2377

Closed
scabug opened this issue Sep 22, 2009 · 9 comments
Closed

Scalac fails to parse Google Protobuf2.x generated Java file #2377

scabug opened this issue Sep 22, 2009 · 9 comments
Milestone

Comments

@scabug
Copy link

scabug commented Sep 22, 2009

|| || java version "1.6.0_16" ||
|| || Java(TM) SE Runtime Environment (build 1.6.0_16-b01) ||
|| || Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode) ||
|| || maven2.1 ||
|| Versions that fail || ||
|| || scala-compiler and scala-library 2.7.3 ||
|| || scala-compiler and scala-library 2.7.6 ||
|| || scala-compile and scala-library 2.8.0-SNAPSHOT from http://scala-tools.org/repo-snapshots ||

$$ mvn compile[[br]]
.[[br]]
:[[br]]
[INFO] use scala command with args in file[[br]]
.../QueueMessage.java:627: error: reference to Builder is ambiguous;
it is imported twice in the same scope by[[br]]
import WorkUnit.[[br]]
and import Stage.
[[br]]
public Builder toBuilder() { return newBuilder(this); }[[br]]
{{^}}[[br]]
one error found[[br]]

@scabug
Copy link
Author

scabug commented Sep 22, 2009

Imported From: https://issues.scala-lang.org/browse/SI-2377?orig=1
Reporter: Jhon Honce (jwhonce)
Attachments:

@scabug
Copy link
Author

scabug commented Sep 22, 2009

Jhon Honce (jwhonce) said:
Sample file that doesn't compile

@scabug
Copy link
Author

scabug commented Sep 22, 2009

Jhon Honce (jwhonce) said:
Protobuf 2.2 version of file that still doesn't parse

@scabug
Copy link
Author

scabug commented Sep 22, 2009

Jhon Honce (jwhonce) said:
Upgraded to Protobuf2.2 with same results.

@scabug
Copy link
Author

scabug commented Sep 22, 2009

@jorgeortiz85 said:
I've also run this problem with Protobuf generated code. A workaround for this issue is to modify the generated Java code with the full path to Builder

public QueueMessage.Stage.Builder toBuilder() { return newBuilder(this); }

However, it's a pain to have to tweak generated code. I'd like to see this bug fixed.

@scabug
Copy link
Author

scabug commented Sep 22, 2009

@paulp said:
As seems always to be the case, as soon as someone mentions "maven" they're describing a bug that I cannot reproduce.

[paulp@jon 2377 (master)]$$ scalac273 QueueMessage.java 
[paulp@jon 2377 (master)]$$ scalac273 QueueMessage.2.java 
[paulp@jon 2377 (master)]$$ scalac276 QueueMessage.java 
[paulp@jon 2377 (master)]$$ scalac276 QueueMessage.2.java 
[paulp@jon 2377 (master)]$$ scalac28 QueueMessage.java 
[paulp@jon 2377 (master)]$$ scalac28 QueueMessage.2.java 
[paulp@jon 2377 (master)]$$ 

If you think this is not some sort of maven configuration bug, please tell me how to reproduce it without involving maven (else this ticket will be closed as invalid.)

@scabug
Copy link
Author

scabug commented Sep 23, 2009

Jhon Honce (jwhonce) said:
Maven-free example of issue

@scabug
Copy link
Author

scabug commented Sep 23, 2009

Jhon Honce (jwhonce) said:
Should have thought to try just one file before submitting the problem. The issue is an interaction between a list of Java and Scala files.

It's not pretty but I attached a tar file with the source files and a bash script showing how the compiler is being invoked. I couldn't include my scala jars because of the upload size limit so you will need to tweak the script to point to your jars before the script will run. I downloaded and built the latest nightly build and can reproduce the issue.

There will be a list compiler errors because I only included a subset of files that I found to show the issue. My friend "the ambiguous Builder" message is buried in there.

Please let me know if I can provide any other information. TIA for your efforts.

@scabug
Copy link
Author

scabug commented Sep 23, 2009

@paulp said:
Your job as a bug reporter is to isolate the bug as much as possible. You are very derelict in this duty, and it cost me a lot of time. However since I am still very keen on seeing jorge ortiz at 3rd and howard wearing a sandwich board (and let's see: I got scalacheck working, I fixed the 5.days bug, and now this -- gentlemen, warm up your boards!) this is fixed in r18756.

Oh, and to see the kind of bug isolation I would have appreciated, examine the test case at http://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/test/files/pos/t2377/ .

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