uqbar-project / wollok

Wollok Programming Language
GNU General Public License v3.0
60 stars 16 forks source link

A lot of errors while opening an SDK file ! #912

Closed javierfernandes closed 7 years ago

javierfernandes commented 8 years ago

If I try to navigate to an object that is built in in the SDK (lang.wlk, etc) then it takes a lot of time. Still it opens it but on the first eclipse I can see a lot of this errors

Caused by: java.lang.RuntimeException: Error while loading resource [classpath:/wollok/lang.wlk]
    at org.uqbar.project.wollok.scoping.WollokGlobalScopeProvider.loadResource(WollokGlobalScopeProvider.java:210)
    at org.uqbar.project.wollok.scoping.WollokGlobalScopeProvider.lambda$6(WollokGlobalScopeProvider.java:185)
    at org.uqbar.project.wollok.scoping.WollokGlobalScopeProvider$$Lambda$16/1426317832.apply(Unknown Source)
    at org.eclipse.xtext.xbase.lib.internal.FunctionDelegate.apply(FunctionDelegate.java:42)
    at com.google.common.collect.Lists$TransformingRandomAccessList.get(Lists.java:572)
    at java.util.AbstractList$Itr.next(AbstractList.java:358)
    at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
    at com.google.common.collect.Iterators$5.hasNext(Iterators.java:543)
    at com.google.common.collect.Iterators$5.hasNext(Iterators.java:542)
    at com.google.common.collect.Iterators$5.hasNext(Iterators.java:542)
    at com.google.common.collect.Iterators.addAll(Iterators.java:356)
    at com.google.common.collect.Lists.newArrayList(Lists.java:146)
    at com.google.common.collect.Iterables.toCollection(Iterables.java:334)
    at com.google.common.collect.Iterables.toArray(Iterables.java:312)
    at org.eclipse.xtext.xbase.lib.Conversions.unwrapArray(Conversions.java:96)
    at org.uqbar.project.wollok.scoping.cache.MapBasedCacheContent.<init>(MapBasedCacheContent.java:36)
    at org.uqbar.project.wollok.scoping.cache.MapBasedWollokGlobalScopeCache.get(MapBasedWollokGlobalScopeCache.java:28)
    at org.uqbar.project.wollok.scoping.WollokGlobalScopeProvider.importedObjects(WollokGlobalScopeProvider.java:75)
    at org.uqbar.project.wollok.scoping.WollokGlobalScopeProvider.getScope(WollokGlobalScopeProvider.java:55)
    at org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider.getScope(DefaultGlobalScopeProvider.java:61)
    at org.eclipse.xtext.scoping.impl.AbstractGlobalScopeProvider.getScope(AbstractGlobalScopeProvider.java:50)
    at org.eclipse.xtext.scoping.impl.AbstractGlobalScopeDelegatingScopeProvider.getGlobalScope(AbstractGlobalScopeDelegatingScopeProvider.java:46)
    at org.eclipse.xtext.scoping.impl.AbstractGlobalScopeDelegatingScopeProvider.getGlobalScope(AbstractGlobalScopeDelegatingScopeProvider.java:42)
    at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getResourceScope(ImportedNamespaceAwareLocalScopeProvider.java:97)
    at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:90)
    at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:88)
    at org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.delegateGetScope(AbstractDeclarativeScopeProvider.java:72)
    at org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.getScope(AbstractDeclarativeScopeProvider.java:104)
    at org.eclipse.xtext.linking.impl.DefaultLinkingService.getScope(DefaultLinkingService.java:59)
    at org.eclipse.xtext.linking.impl.DefaultLinkingService.getLinkedObjects(DefaultLinkingService.java:119)
    at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:247)
    at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:222)
    ... 16 more
Caused by: org.eclipse.xtext.resource.ClasspathUriResolutionException: org.eclipse.xtext.resource.FileNotFoundOnClasspathException: Couldn't find resource on classpath. URI was 'classpath:/wollok/lang.wlk'
    at org.eclipse.xtext.resource.ClassloaderClasspathUriResolver.resolve(ClassloaderClasspathUriResolver.java:49)
    at org.eclipse.xtext.resource.XtextResourceSet.resolveClasspathURI(XtextResourceSet.java:221)
    at org.eclipse.xtext.resource.XtextResourceSet.access$0(XtextResourceSet.java:220)
    at org.eclipse.xtext.resource.XtextResourceSet$1.normalize(XtextResourceSet.java:284)
    at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:239)
    at org.eclipse.xtext.resource.SynchronizedXtextResourceSet.getResource(SynchronizedXtextResourceSet.java:25)
    at org.uqbar.project.wollok.scoping.WollokGlobalScopeProvider.loadResource(WollokGlobalScopeProvider.java:201)
    ... 47 more
Caused by: org.eclipse.xtext.resource.FileNotFoundOnClasspathException: Couldn't find resource on classpath. URI was 'classpath:/wollok/lang.wlk'
    at org.eclipse.xtext.resource.ClassloaderClasspathUriResolver.findResourceOnClasspath(ClassloaderClasspathUriResolver.java:61)
    at org.eclipse.xtext.resource.ClassloaderClasspathUriResolver.resolve(ClassloaderClasspathUriResolver.java:46)
    ... 53 more

I believe that the underlying problem is the way we are NOT modelling classpath. XText and EMF uses resourcesets and URIs to identify files. Some of those URLS are "classpath:". like those on the sdk

And currently they cannot be resolved.

I think that we need to see how we can contribute elements to a project's classpath so that it can be automatically resolved.

I believe that if we do so, also the issue #375

matifreyre commented 8 years ago

It sounds like related to #900.

On Fri, Aug 5, 2016 at 5:17 PM, javierfernandes notifications@github.com wrote:

If I try to navigate to an object that is built in in the SDK (lang.wlk, etc) then it takes a lot of time. Still it opens it but on the first eclipse I can see a lot of this errors

Caused by: java.lang.RuntimeException: Error while loading resource [classpath:/wollok/lang.wlk] at org.uqbar.project.wollok.scoping.WollokGlobalScopeProvider.loadResource(WollokGlobalScopeProvider.java:210) at org.uqbar.project.wollok.scoping.WollokGlobalScopeProvider.lambda$6(WollokGlobalScopeProvider.java:185) at org.uqbar.project.wollok.scoping.WollokGlobalScopeProvider$$Lambda$16/1426317832.apply(Unknown Source) at org.eclipse.xtext.xbase.lib.internal.FunctionDelegate.apply(FunctionDelegate.java:42) at com.google.common.collect.Lists$TransformingRandomAccessList.get(Lists.java:572) at java.util.AbstractList$Itr.next(AbstractList.java:358) at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48) at com.google.common.collect.Iterators$5.hasNext(Iterators.java:543) at com.google.common.collect.Iterators$5.hasNext(Iterators.java:542) at com.google.common.collect.Iterators$5.hasNext(Iterators.java:542) at com.google.common.collect.Iterators.addAll(Iterators.java:356) at com.google.common.collect.Lists.newArrayList(Lists.java:146) at com.google.common.collect.Iterables.toCollection(Iterables.java:334) at com.google.common.collect.Iterables.toArray(Iterables.java:312) at org.eclipse.xtext.xbase.lib.Conversions.unwrapArray(Conversions.java:96) at org.uqbar.project.wollok.scoping.cache.MapBasedCacheContent.(MapBasedCacheContent.java:36) at org.uqbar.project.wollok.scoping.cache.MapBasedWollokGlobalScopeCache.get(MapBasedWollokGlobalScopeCache.java:28) at org.uqbar.project.wollok.scoping.WollokGlobalScopeProvider.importedObjects(WollokGlobalScopeProvider.java:75) at org.uqbar.project.wollok.scoping.WollokGlobalScopeProvider.getScope(WollokGlobalScopeProvider.java:55) at org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider.getScope(DefaultGlobalScopeProvider.java:61) at org.eclipse.xtext.scoping.impl.AbstractGlobalScopeProvider.getScope(AbstractGlobalScopeProvider.java:50) at org.eclipse.xtext.scoping.impl.AbstractGlobalScopeDelegatingScopeProvider.getGlobalScope(AbstractGlobalScopeDelegatingScopeProvider.java:46) at org.eclipse.xtext.scoping.impl.AbstractGlobalScopeDelegatingScopeProvider.getGlobalScope(AbstractGlobalScopeDelegatingScopeProvider.java:42) at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getResourceScope(ImportedNamespaceAwareLocalScopeProvider.java:97) at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:90) at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:88) at org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.delegateGetScope(AbstractDeclarativeScopeProvider.java:72) at org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.getScope(AbstractDeclarativeScopeProvider.java:104) at org.eclipse.xtext.linking.impl.DefaultLinkingService.getScope(DefaultLinkingService.java:59) at org.eclipse.xtext.linking.impl.DefaultLinkingService.getLinkedObjects(DefaultLinkingService.java:119) at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:247) at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:222) ... 16 moreCaused by: org.eclipse.xtext.resource.ClasspathUriResolutionException: org.eclipse.xtext.resource.FileNotFoundOnClasspathException: Couldn't find resource on classpath. URI was 'classpath:/wollok/lang.wlk' at org.eclipse.xtext.resource.ClassloaderClasspathUriResolver.resolve(ClassloaderClasspathUriResolver.java:49) at org.eclipse.xtext.resource.XtextResourceSet.resolveClasspathURI(XtextResourceSet.java:221) at org.eclipse.xtext.resource.XtextResourceSet.access$0(XtextResourceSet.java:220) at org.eclipse.xtext.resource.XtextResourceSet$1.normalize(XtextResourceSet.java:284) at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:239) at org.eclipse.xtext.resource.SynchronizedXtextResourceSet.getResource(SynchronizedXtextResourceSet.java:25) at org.uqbar.project.wollok.scoping.WollokGlobalScopeProvider.loadResource(WollokGlobalScopeProvider.java:201) ... 47 moreCaused by: org.eclipse.xtext.resource.FileNotFoundOnClasspathException: Couldn't find resource on classpath. URI was 'classpath:/wollok/lang.wlk' at org.eclipse.xtext.resource.ClassloaderClasspathUriResolver.findResourceOnClasspath(ClassloaderClasspathUriResolver.java:61) at org.eclipse.xtext.resource.ClassloaderClasspathUriResolver.resolve(ClassloaderClasspathUriResolver.java:46) ... 53 more

I believe that the underlying problem is the way we are NOT modelling classpath. XText and EMF uses resourcesets and URIs to identify files. Some of those URLS are "classpath:". like those on the sdk

And currently they cannot be resolved.

I think that we need to see how we can contribute elements to a project's classpath so that it can be automatically resolved.

I believe that if we do so, also the issue #375 https://github.com/uqbar-project/wollok/issues/375

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/uqbar-project/wollok/issues/912, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ-EZrIJcGEQSZIac-vb8FBxGap9rWijks5qc5pUgaJpZM4JeBoe .

javierfernandes commented 8 years ago

right !

I wonder is this happened all along until now. I think that I remember waiting the editor to open the sdk file, but didn't notice the error before.

javierfernandes commented 8 years ago

I don't fully understand what is going on here. Because the linker is able to resolve objects and classes from those sdk files, but then the highlighter and some other components are not. They throw this error.

I tried to change manifest URI creation from "classpath:" format to "platform:/plugin" as described in this article

http://www.davehofmann.de/?p=232

But weird things started to happen. Like the Object proxy was created while linking WClass.parent but later that linkage had an error "Could not resolve reference to Class Object" (tried wollok.lang.Object). And it actually failled with a NPE while trying to report the error, because it tried to locate that synthetic object in the source code, which of course had no offset or location at all :(

fdodino commented 7 years ago

I think this issue was already solved by me as I fixed Xpect tests, didn't know how. I'll mark as Done, @npasserini .