Closed jvasileff closed 8 years ago
Do those also happen with ceylon run
?
No, just test.
Weird
I can't reproduce the third one. It works for me. Are you sure you're using the right ceylon
command?
I can't reproduce the first because the file does not exist where you point it, and where it is, line 47 points to an import }
, so that's probably not the line you meant.
I can reproduce the second:
atlantis stephane 09:27 jl4c-guava $ ../ceylon-dist/dist/bin/ceylon test com.vasileff.jl4c.guava
ceylon test: Error while loading the com.vasileff.jl4c.guava/0.0.1 module:
Error while resolving type of getter 'delegate$priv$' for com.vasileff.jl4c.guava.collect::ImmutableMapBuilder:
Could not find type 'K'
com.redhat.ceylon.model.loader.ModelResolutionException: Error while loading the com.vasileff.jl4c.guava/0.0.1 module:
Error while resolving type of getter 'delegate$priv$' for com.vasileff.jl4c.guava.collect::ImmutableMapBuilder:
Could not find type 'K'
at com.redhat.ceylon.compiler.java.runtime.model.RuntimeModelLoader$1.reportError(RuntimeModelLoader.java:209)
at com.redhat.ceylon.model.typechecker.model.UnknownType.reportErrors(UnknownType.java:94)
at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getMetamodel(Metamodel.java:595)
at com.redhat.ceylon.compiler.java.runtime.metamodel.decl.ValueDeclarationImpl.<init>(ValueDeclarationImpl.java:48)
at com.redhat.ceylon.compiler.java.runtime.metamodel.Metamodel.getOrCreateMetamodel(Metamodel.java:425)
at com.redhat.ceylon.compiler.java.runtime.metamodel.decl.ClassOrInterfaceDeclarationImpl.addDeclarationTo(ClassOrInterfaceDeclarationImpl.java:114)
at com.redhat.ceylon.compiler.java.runtime.metamodel.decl.ClassOrInterfaceDeclarationImpl.init(ClassOrInterfaceDeclarationImpl.java:99)
at com.redhat.ceylon.compiler.java.runtime.metamodel.decl.ClassDeclarationImpl.init(ClassDeclarationImpl.java:58)
at com.redhat.ceylon.compiler.java.runtime.metamodel.decl.ClassOrInterfaceDeclarationImpl.checkInit(ClassOrInterfaceDeclarationImpl.java:163)
at com.redhat.ceylon.compiler.java.runtime.metamodel.decl.ClassOrInterfaceDeclarationImpl.filteredMembers(ClassOrInterfaceDeclarationImpl.java:231)
at com.redhat.ceylon.compiler.java.runtime.metamodel.decl.ClassOrInterfaceDeclarationImpl.annotatedMemberDeclarations(ClassOrInterfaceDeclarationImpl.java:205)
at ceylon.test.core.findCandidatesInClass_.findCandidatesInClass(DefaultTestRunner.ceylon:207)
at ceylon.test.core.findCandidatesInPackage_.findCandidatesInPackage(DefaultTestRunner.ceylon:201)
So that one is because we generate:
@TypeInfo("com.google.common.collect::ImmutableMap<K,V>.Builder<Key,Item>")
Which is wrong, since K
does not exist. It should be Key
I guess. Now, whose fault is it?
Damn, when I try to reproduce in a test I get the correct signature:
@TypeInfo("com.redhat.ceylon.compiler.java.test.issues.bug23xx::Bug2388Java.Builder<Key,Value>")
private final .com.redhat.ceylon.compiler.java.test.issues.bug23xx.Bug2388Java.Builder<Key, Value> getDelegate$priv$() {
return delegate;
}
Ah, I can reproduce it for that guava type. Could be something module-related?
No, it has to do with overloading. If the constructor of Builder
is overloaded I can reproduce it without Guava:
@TypeInfo("com.redhat.ceylon.compiler.java.test.issues.bug23xx::Bug2388Java<K,V>.Builder<Key,Value>")
@gavinking do you remember what the right form for a qualifying's static type is in Java? Should it have type arguments? I always forget. I guess it should not, as they may have no relation to the qualified type's arguments so we can't infer them.
I believe you should leave them out. But no, I don't quite remember.
So it looks like Declaration.getMemberContainerType()
is to blame because it returns a Type
for the container even for that static inner class. I can make it return null
for the container of staticallyImportable
declarations (except Java enums which have a virtual container type that is required).
So that second test is resolved, and the other ones require user intervention, moving to 1.3 for now.
On the third one, strange. Maybe it would work if I recompiled everything with Java 7? But I think the command is correct:
jvasileff@lynx:ceylon-sdk$ ceylon test ceylon.transaction
ceylon test: Error while loading the ceylon.transaction/1.2.0 module:
Declaration 'javax.transaction.xa.XAResource' could not be found in module 'ceylon.transaction' or its imported modules but was found in the non-
On the first one, yes, sorry, the code just changed. It's:
or
value virtualFiles = listings.indexed.map((listing) => object
satisfies VirtualFile {
shared actual
List<out VirtualFile> children
=> javaList {};
...
where VirtualFile
is com.redhat.ceylon.compiler.typechecker.io::VirtualFile
. Although, perhaps the problem here is with javaList {}
, which I think involves guava. I'll have to try removing that.
Nope, still happens without javaList
. So VirtualFile
is the likely suspect.
On the third one, strange. Maybe it would work if I recompiled everything with Java 7? But I think the command is correct:
But this works for me, which is what's weird.
Of course, I can't reproduce # 1 with:
shared void run() {
value vf = object satisfies VirtualFile {
shared actual List<out VirtualFile> children => nothing;
shared actual Integer compareTo(VirtualFile other) => nothing;
shared actual Boolean folder => nothing;
shared actual InputStream inputStream => nothing;
shared actual String name => nothing;
shared actual String path => nothing;
shared actual Boolean \iexists() => nothing;
};
}
that would be too easy.
gotit
This fails (very strange once you start trying variations):
import java.io {
InputStream
}
import java.util {
List
}
import com.redhat.ceylon.compiler.typechecker.io {
VirtualFile
}
shared void run({String*} dummy = {}) {
value vfs = [].map((x) => object satisfies VirtualFile {
shared actual List<VirtualFile> children => nothing;
shared actual Integer compareTo(VirtualFile other) => nothing;
shared actual Boolean folder => nothing;
shared actual InputStream inputStream => nothing;
shared actual String name => nothing;
shared actual String path => nothing;
shared actual Boolean \iexists() => nothing;
});
}
with
native("jvm")
module simple "1.0.0" {
import java.base "8";
import com.redhat.ceylon.typechecker "1.2.0";
}
Changing
shared void run({String*} dummy = {}) {
to any of these
shared void run() {
shared void run({String*} dummy) {
shared void run([String*] dummy = []) {
shared void run({String+} dummy = {""}) {
makes the problem go away, or at least masks it.
Here's a shorter version (no imports):
void run(Anything dummy = {}) {
value f = () => object {};
}
VirtualFile
was a red herring.
I fixed the first one now, thanks. Narrowing it down made it much easier for me.
So we're left with the third one. Are you saying you're having the problem with Java 8 then? Because myself with Java 7 I can't reproduce.
I just recompiled everything with Java 8 and ran it without issues.
OK now I understand, I was running ceylon test test.ceylon.transation
, not ceylon test ceylon.transaction
. I can reproduce. Sorry about that.
OK, the last one is due to the javax.transaction.xa.XAResource
being in more than one package. I can't fix that in time for 1.2, and it's a dupe of #1827, so I'm going to close this.
I haven't been able to create a small test cases yet, so I'll dump what I have for now and try again later if necessary.
Case 1: Issue with an
object
value that extends a Java class in a top-level functionUnless this statement (https://github.com/jvasileff/ceylon-dart/blob/master/ceylon-dart-compiler/source/com/vasileff/ceylon/dart/compiler/compile.ceylon#L47) is uncommented, I get:
Case 2: Class member of a generic java type
For https://github.com/jvasileff/jl4c-guava/blob/master/source/com/vasileff/jl4c/guava/collect/ImmutableSetBuilder.ceylon
Case 3: Cannot run
ceylon test
onceylon.transaction
Trying
ceylon test ceylon.transaction
in theceylon-sdk
directory results in: