Comments (3)
I think this is a different kind of bug with a similar error message, as the one of this bug report only happens on startup.
I don't think it has anything to do with a different kind of IContainer
object. The problem is that when a language is dynamically loaded, using parts of that language sometimes requires reading files from its build directory, and when Eclipse is not made aware of this dependency (called scheduling rules), these kinds of errors are thrown.
In your case, executing a command of tiger.spoofax3
requires constraint analysis, which in turn requires reading constraint analyzer aterm files from the tiger.spoofax3/build/generated/resources/metalang/mb/tiger/src-gen
directory. Eclipse is not made aware of this dependency, so an error is triggered.
To work around the problem, you can make your command depend on the project as an enclosing project by adding several things to spoofaxc.cfg
.
- Add a
project
parameter to yourcommand-def
:
project {
type = java mb.resource.hierarchical.ResourcePath
argument-providers = [EnclosingContext(Project)]
}
- Add
required-enclosing-resource-types = [Project]
to allcommand-action
menu items of your command. - Add
public final ResourcePath project
to yourArgs
class, accept it in the constructor, and updateequals
/hashCode
/toString
.
A proper solution would be to add the correct scheduling rules when a language is dynamically loaded, to:
- RunCommandHandler/DynamicRunCommandHandler for commands.
- SpoofaxEditorBase/DynamicEditor for editor updates.
from spoofax-pie.
This bug also happens when I try to run a command on a resource in the Eclipse LWB.
Command definition (in spoofaxc.cfg
):
let inlineMethodTaskDef = task-def mb.tiger.task.TigerInlineMethodCallTaskDef
let inlineMethodCommand = command-def {
task-def = inlineMethodTaskDef
type = java mb.tiger.command.TigerInlineMethodCallCommand
display-name = "Inline method call"
description = "Inline a method call."
parameters = [
resource {
type = java mb.resource.ResourceKey
required = true
argument-providers = [ Context(ReadableResource) ]
}
region {
type = java mb.common.region.Region
required = false
argument-providers = [ Context(Region) ]
}
]
}
editor-context-menu [
menu "Debug" [
command-action {
command-def = inlineMethodCommand
execution-type = Once
}
]
]
resource-context-menu [
menu "Debug" [
command-action {
command-def = inlineMethodCommand
execution-type = Once
required-resource-types = [File]
}
]
]
Stack trace:
14:18:44.995 | INFO | Worker-39: Inline method call | mb.pie.runtime.tracer.LoggingTracer | ← [4.460319] exception: java.lang.IllegalArgumentException: Attempted to beginRule: F/tiger.spoofax3/build/generated/resources/metalang/mb/tiger/src-gen, does not match outer scope rule: MultiRule[L/tiger.spoofax3/test/simple-fact.tig,F/tiger.spoofax3/test]
java.lang.IllegalArgumentException: Attempted to beginRule: F/tiger.spoofax3/build/generated/resources/metalang/mb/tiger/src-gen, does not match outer scope rule: MultiRule[L/tiger.spoofax3/test/simple-fact.tig,F/tiger.spoofax3/test]
at org.eclipse.core.runtime.Assert.isLegal(Assert.java:66)
at org.eclipse.core.internal.jobs.ThreadJob.illegalPush(ThreadJob.java:137)
at org.eclipse.core.internal.jobs.ThreadJob.push(ThreadJob.java:392)
at org.eclipse.core.internal.jobs.ImplicitJobs.begin(ImplicitJobs.java:88)
at org.eclipse.core.internal.jobs.JobManager.beginRule(JobManager.java:299)
at org.eclipse.core.internal.resources.WorkManager.checkIn(WorkManager.java:124)
at org.eclipse.core.internal.resources.Workspace.prepareOperation(Workspace.java:2242)
at org.eclipse.core.internal.resources.Resource.refreshLocal(Resource.java:1554)
at mb.spoofax.eclipse.resource.EclipseResource.walk(EclipseResource.java:381)
at mb.resource.hierarchical.HierarchicalResource.walkForEach(HierarchicalResource.java:381)
at mb.resource.hierarchical.HierarchicalResource.walkForEach(HierarchicalResource.java:375)
at mb.tiger.task.TigerAnalyze.lambda$analyze$1(%2Ftiger.spoofax3%2Fbuild%2Fgenerated%2Fsources%2Fadapter%2Fmb%2Ftiger%2Ftask%2FTigerAnalyze.java:52)
at mb.spoofax.resource.ClassLoaderResources.performWithDefinitionResourceLocationsTryAsNative(ClassLoaderResources.java:122)
at mb.tiger.task.TigerAnalyze.analyze(%2Ftiger.spoofax3%2Fbuild%2Fgenerated%2Fsources%2Fadapter%2Fmb%2Ftiger%2Ftask%2FTigerAnalyze.java:50)
at mb.constraint.pie.ConstraintAnalyzeTaskDef.lambda$exec$0(ConstraintAnalyzeTaskDef.java:75)
at mb.common.result.Result.lambda$mapCatchingOrRethrow$4(Result.java:332)
at mb.common.result.ResultUtil.tryCatchOrRethrow(ResultUtil.java:39)
at mb.common.result.Result.mapCatchingOrRethrow(Result.java:332)
at mb.constraint.pie.ConstraintAnalyzeTaskDef.exec(ConstraintAnalyzeTaskDef.java:73)
at mb.constraint.pie.ConstraintAnalyzeTaskDef.exec(ConstraintAnalyzeTaskDef.java:17)
at mb.pie.api.Task.exec(Task.java:56)
at mb.pie.runtime.exec.TaskExecutor.execInternal(TaskExecutor.java:130)
at mb.pie.runtime.exec.TaskExecutor.exec(TaskExecutor.java:87)
at mb.pie.runtime.exec.TopDownRunner.exec(TopDownRunner.java:194)
at mb.pie.runtime.exec.TopDownRunner.executeOrGetExisting(TopDownRunner.java:139)
at mb.pie.runtime.exec.TopDownRunner.require(TopDownRunner.java:81)
at mb.pie.runtime.exec.ExecContextImpl.require(ExecContextImpl.java:118)
at mb.pie.runtime.exec.ExecContextImpl.require(ExecContextImpl.java:141)
at mb.pie.api.STask.get(STask.java:61)
at mb.pie.runtime.exec.ExecContextImpl.require(ExecContextImpl.java:151)
at mb.statix.referenceretention.pie.InlineMethodCallTaskDef.exec(InlineMethodCallTaskDef.java:113)
at mb.tiger.task.TigerInlineMethodCallTaskDef.exec(%2Ftiger.spoofax3%2Fsrc%2Fmain%2Fjava%2Fmb%2Ftiger%2Ftask%2FTigerInlineMethodCallTaskDef.java:46)
at mb.tiger.task.TigerInlineMethodCallTaskDef.exec(%2Ftiger.spoofax3%2Fsrc%2Fmain%2Fjava%2Fmb%2Ftiger%2Ftask%2FTigerInlineMethodCallTaskDef.java:16)
at mb.pie.api.Task.exec(Task.java:56)
at mb.pie.runtime.exec.TaskExecutor.execInternal(TaskExecutor.java:130)
at mb.pie.runtime.exec.TaskExecutor.exec(TaskExecutor.java:87)
at mb.pie.runtime.exec.TopDownRunner.exec(TopDownRunner.java:194)
at mb.pie.runtime.exec.TopDownRunner.executeOrGetExisting(TopDownRunner.java:139)
at mb.pie.runtime.exec.TopDownRunner.require(TopDownRunner.java:81)
at mb.pie.runtime.exec.TopDownRunner.requireInitial(TopDownRunner.java:59)
at mb.pie.runtime.MixedSessionImpl.lambda$requireWithoutObserving$2(MixedSessionImpl.java:110)
at mb.pie.runtime.SessionImpl.handleException(SessionImpl.java:221)
at mb.pie.runtime.MixedSessionImpl.requireWithoutObserving(MixedSessionImpl.java:110)
at mb.spoofax.eclipse.pie.PieRunner.requireWithoutObserving(PieRunner.java:494)
at mb.spoofax.eclipse.pie.PieRunner.requireCommand(PieRunner.java:322)
at mb.spoofax.eclipse.command.RunCommandJob.run(RunCommandJob.java:67)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
from spoofax-pie.
The cause seems to be that the IContainer
retrieved in the code is different from the one Eclipse expects. Spoofax uses a similar approach to EGit, and they fixed the same issue at some point. EGit Diff
from spoofax-pie.
Related Issues (20)
- IllegalStateException: The root project is not yet available for build HOT 1
- Support Gradle 7 HOT 1
- Invalid AST shape error when using strings for brackets HOT 1
- Having no SDF3 files in the main source directory results in compilation issues in generated files HOT 2
- Forgetting to specify `context-free start-symbols` in SDF3 leads to unclear parsing errors HOT 1
- Empty lines are considered "uncommented" for toggle-comment sakes HOT 1
- Old generated signatures persist even after source file is deleted/renamed HOT 1
- Task with same key is visited with different input when changing SDF3 source directory HOT 1
- SPT tests ignore start symbol HOT 1
- Literal character incorrectly parsed as layout
- BUG: parser returned null output even though parsing did not fail
- Eclipse dependencies confuse IntelliJ
- Source exports should be language specific
- Java Compilation does not show error messages for failed annotation processors. HOT 1
- Debug commands showing analyzed things fail on the command line
- Error messages from commands are not printed on the command line
- Spurious Hidden Dependency Error
- `ImmutableSeparatorRepr` not serializable
- Duplicate error when using Gradle 7.1+
- `ConcurrentModificationException` on editor update of dynamic language that is currently built
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spoofax-pie.