GithubHelp home page GithubHelp logo

Comments (3)

Gohla avatar Gohla commented on July 1, 2024 1

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.

  1. Add a project parameter to your command-def:
    project {
      type = java mb.resource.hierarchical.ResourcePath
      argument-providers = [EnclosingContext(Project)]
    }
  1. Add required-enclosing-resource-types = [Project] to all command-action menu items of your command.
  2. Add public final ResourcePath project to your Args class, accept it in the constructor, and update equals/hashCode/toString.

A proper solution would be to add the correct scheduling rules when a language is dynamically loaded, to:

from spoofax-pie.

Virtlink avatar Virtlink commented on July 1, 2024

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.

Virtlink avatar Virtlink commented on July 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.