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 · 1 comment
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

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

2 participants