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

"Unable to locate class file for inner class" (mixed compilation bug?) #797

Open
dwijnand opened this issue Jun 17, 2020 · 6 comments
Open
Labels

Comments

@dwijnand
Copy link
Member

(Reported by @elfprince13 as scala/bug#11062.)

I have two source files, one Java, one Scala.
The Java class definition is as follows:

public class HeapNode<Elem> extends Node<HeapNode<Elem>> implements Cloneable {
	volatile LazyBraunHeapLF.NodeEvalState<Elem> state;
	
	HeapNode(LazyBraunHeapLF.NodeEvalState<Elem> initState){
		state = initState;
	}
	
	@SuppressWarnings("rawtypes")
	public static final AtomicReferenceFieldUpdater<HeapNode, LazyBraunHeapLF.NodeEvalState> updateState 
					= AtomicReferenceFieldUpdater.newUpdater(HeapNode.class, LazyBraunHeapLF.NodeEvalState.class, "state");

	
}

The Scala source contains the following:

object LazyBraunHeapLF {
	
	class EmptyNode[E] extends HeapNode[E](Empty[E]()){
		marked = true
	}
	
	sealed trait Immediate[E]{ this: NodeEvalState[E] =>
		def force:NodeEvalState[E] with Immediate[E] = this
	}
	
	sealed abstract class NodeEvalState[E] {
		def force: NodeEvalState[E] with Immediate[E]
	}
	
	case class Empty[E]() extends NodeEvalState[E] with Immediate[E]
	// The remainder is commented out for a M(N)WE
}

Everything works fine with a clean build, or if the definition of class EmptyNode[E] is commented out; however, after roughly ~1 edit cycle, I get the following error message:

[error] Unable to locate class corresponding to inner class entry for NodeEvalState in owner LazyBraunHeapLF
[error] one error found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 2 s, completed Aug 8, 2018 11:30:33 AM

I'm using Scala 2.12.6 on Java 8. Notably, the class file in question exists on my file system.

@dlilljegren
Copy link

If you in the Java class do
import LazyBraunHeapLF.NodeEvalState

and replace then in the Java class replace LazyBraunHeapLF.NodeEvalState with just NodeEvalState it will work

@Friendseeker
Copy link
Member

Friendseeker commented Sep 14, 2024

@dlilljegren Sorry for a really late ping. But if you have the access to the codebase exhibiting the issue, may I receive a copy of the codebase/access to the codebase?

Currently a reproduction is provided but the reproduction involves some custom classes such as HeapNode or LazyBraunHeapLF . I tried to do a Google Search online but failed to find the implementation for these classes.

@elfprince13
Copy link

elfprince13 commented Sep 15, 2024 via email

@Friendseeker
Copy link
Member

Jerry I have no recollection of which version of my code exhibited this issue but if you are trying to repro I could probably track it down. Is the repro snippet missing something ? -- ~Thomas

Thanks for the reply! One thing that is missing is the definition of Node. Ideally if you can create a small zip file or Github Repo for which Zinc contributors can just simply download/clone, click compile button and then reproduce the issue, that would be extremely beneficial.

@Friendseeker
Copy link
Member

Friendseeker commented Sep 15, 2024

@ghik Sorry for 4 year old ping. Since you encountered the same issue, I would like to also request a reproduction from you if feasible. It doesn't have to be fully minimized (although a reproduction containing only several files can really make debugging easier).

Having 2 different reproductions for 1 issue can really help rule out some possibilities, especially if the 2 reproductions involve seemingly different source code. So it would help me & other zinc contributors a lot.

@ghik
Copy link

ghik commented Sep 15, 2024

@Friendseeker unfortunately, I'm no longer working in the company where I encountered this. It was a relatively large, mixed Java-Scala codebase, and we used to compile it in "mixed" compilation mode, where Java & Scala code can refer to each other in both ways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants