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

The first part of the alias is invalid jeo.seq.of2 #127

Closed
volodya-lombrozo opened this issue Dec 10, 2024 · 14 comments
Closed

The first part of the alias is invalid jeo.seq.of2 #127

volodya-lombrozo opened this issue Dec 10, 2024 · 14 comments
Assignees
Labels
bug Something isn't working

Comments

@volodya-lombrozo
Copy link
Member

I'm getting this error:

Caused by: java.lang.IllegalStateException: EO is incorrect: [[broken-alias ERROR]:0 The first part of the alias is invalid: "jeo.seq.of2", [broken-alias ERROR]:0 The first part of the alias is invalid: "jeo.seq.of0", [broken-alias ERROR]:0 The first part of the alias is invalid: "jeo.seq.of1", [broken-alias ERROR]:0 The first part of the alias is invalid: "jeo.method", [broken-alias ERROR]:0 The first part of the alias is invalid: "jeo.params", [broken-alias ERROR]:0 The first part of the alias is invalid: "jeo.int", [broken-alias ERROR]:0 The first part of the alias is invalid: "jeo.annotation-property", [broken-alias ERROR]:0 The first part of the alias is invalid: "jeo.bool", [broken-alias ERROR]:0 The first part of the alias is invalid: "jeo.class", [broken-alias ERROR]:0 The first part of the alias is invalid: "jeo.annotation", [broken-alias ERROR]:0 The first part of the alias is invalid: "jeo.maxs", [mandatory-version WARNING]:0 The +version meta is mandatory, but is absent, [incorrect-package WARNING]:0 The format of the +package meta is wrong: "j$org.j$eolang.j$hone.j$param", [unsorted-metas WARNING]:0 The "alias jeo.seq.of2" meta is out of order, [unsorted-metas WARNING]:0 The "alias jeo.seq.of0" meta is out of order, [unsorted-metas WARNING]:0 The "alias jeo.seq.of1" meta is out of order, [unsorted-metas WARNING]:0 The "alias jeo.method" meta is out of order, [unsorted-metas WARNING]:0 The "alias jeo.params" meta is out of order, [unsorted-metas WARNING]:0 The "alias jeo.int" meta is out of order, [unsorted-metas WARNING]:0 The "alias jeo.annotation-property" meta is out of order, [unsorted-metas WARNING]:0 The "alias jeo.bool" meta is out of order, [unsorted-metas WARNING]:0 The "alias jeo.class" meta is out of order, [unsorted-metas WARNING]:0 The "alias jeo.annotation" meta is out of order, [unsorted-metas WARNING]:0 The "alias jeo.maxs" meta is out of order, [mandatory-home WARNING]:0 The +home meta is mandatory, but is absent]
    at org.eolang.jeo.representation.VerifiedEo.asXml (VerifiedEo.java:71)
    at org.eolang.jeo.representation.MeasuredEo.asXml (MeasuredEo.java:58)
    at org.eolang.jeo.representation.BytecodeRepresentation.toEO (BytecodeRepresentation.java:117)
    at org.eolang.jeo.Disassembling.transform (Disassembling.java:86)
    at org.eolang.jeo.Caching.tryTransform (Caching.java:93)
    at org.eolang.jeo.Caching.transform (Caching.java:63)
    at org.eolang.jeo.Logging.transform (Logging.java:83)
    at org.eolang.jeo.Disassembler.disassemble (Disassembler.java:113)
    at org.eolang.jeo.ParallelTranslator.translate (ParallelTranslator.java:70)
    at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:197)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining (ArrayList.java:1708)
    at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:509)
    at java.util.stream.ForEachOps$ForEachTask.compute (ForEachOps.java:291)
    at java.util.concurrent.CountedCompleter.exec (CountedCompleter.java:754)
    at java.util.concurrent.ForkJoinTask.doExec (ForkJoinTask.java:387)
    at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec (ForkJoinPool.java:1312)
    at java.util.concurrent.ForkJoinPool.scan (ForkJoinPool.java:1843)
    at java.util.concurrent.ForkJoinPool.runWorker (ForkJoinPool.java:1808)
    at java.util.concurrent.ForkJoinWorkerThread.run (ForkJoinWorkerThread.java:188)

When use the following java code:

final Collection<Defect> defects = new Program(
    new StrictXML(res)
).defects();
if (defects.size() > 0) {
    throw new IllegalStateException(
        String.format(
            "EO is incorrect: %s",
            defects
        )
    );
}

This significantly blocks the development.

Please fix the plugin by providing a human-readable message with the actions I need to take to resolve the problem.

@volodya-lombrozo
Copy link
Member Author

@yegor256 Could you help with it, please?

@yegor256
Copy link
Member

@volodya-lombrozo unfortunately, we don't publish documentation for every lint, but we have it, check this page: https://github.com/objectionary/lints/blob/master/src/main/resources/org/eolang/motives/aliases/broken-alias-first.md It seems, the way you format <meta> element is not correct. Try to use the example (with head, tail, and two parts)

yegor256 added a commit that referenced this issue Dec 10, 2024
@volodya-lombrozo
Copy link
Member Author

@yegor256 Can you please connect the documentation with a failure message, please? It will help to mitigate issues.

@volodya-lombrozo
Copy link
Member Author

@yegor256 Moreover, the documentation you sent doesn't help. I'm getting the same error for the following metas:

[ERROR]    <metas>
[ERROR]       <meta>
[ERROR]          <head>package</head>
[ERROR]          <tail>j$org.j$eolang.j$hone.j$param</tail>
[ERROR]          <part>j$org.j$eolang.j$hone.j$param</part>
[ERROR]       </meta>
[ERROR]       <meta>
[ERROR]          <head>alias</head>
[ERROR]          <tail>seq.of2 jeo.seq.of2</tail>
[ERROR]          <part>jeo.seq.of2</part>
[ERROR]          <part>seq.of2</part>
[ERROR]       </meta>
[ERROR]       <meta>
[ERROR]          <head>alias</head>
[ERROR]          <tail>seq.of0 jeo.seq.of0</tail>
[ERROR]          <part>jeo.seq.of0</part>
[ERROR]          <part>seq.of0</part>
[ERROR]       </meta>
[ERROR]       <meta>
[ERROR]          <head>alias</head>
[ERROR]          <tail>seq.of1 jeo.seq.of1</tail>
[ERROR]          <part>jeo.seq.of1</part>
[ERROR]          <part>seq.of1</part>
[ERROR]       </meta>
[ERROR]       <meta>
[ERROR]          <head>alias</head>
[ERROR]          <tail>method jeo.method</tail>
[ERROR]          <part>jeo.method</part>
[ERROR]          <part>method</part>
[ERROR]       </meta>
[ERROR]       <meta>
[ERROR]          <head>alias</head>
[ERROR]          <tail>params jeo.params</tail>
[ERROR]          <part>jeo.params</part>
[ERROR]          <part>params</part>
[ERROR]       </meta>
[ERROR]       <meta>
[ERROR]          <head>alias</head>
[ERROR]          <tail>int jeo.int</tail>
[ERROR]          <part>jeo.int</part>
[ERROR]          <part>int</part>
[ERROR]       </meta>
[ERROR]       <meta>
[ERROR]          <head>alias</head>
[ERROR]          <tail>annotation-property jeo.annotation-property</tail>
[ERROR]          <part>jeo.annotation-property</part>
[ERROR]          <part>annotation-property</part>
[ERROR]       </meta>
[ERROR]       <meta>
[ERROR]          <head>alias</head>
[ERROR]          <tail>bool jeo.bool</tail>
[ERROR]          <part>jeo.bool</part>
[ERROR]          <part>bool</part>
[ERROR]       </meta>
[ERROR]       <meta>
[ERROR]          <head>alias</head>
[ERROR]          <tail>class jeo.class</tail>
[ERROR]          <part>jeo.class</part>
[ERROR]          <part>class</part>
[ERROR]       </meta>
[ERROR]       <meta>
[ERROR]          <head>alias</head>
[ERROR]          <tail>annotation jeo.annotation</tail>
[ERROR]          <part>jeo.annotation</part>
[ERROR]          <part>annotation</part>
[ERROR]       </meta>
[ERROR]       <meta>
[ERROR]          <head>alias</head>
[ERROR]          <tail>maxs jeo.maxs</tail>
[ERROR]          <part>jeo.maxs</part>
[ERROR]          <part>maxs</part>
[ERROR]       </meta>
[ERROR]    </metas>

Please, help. It's still a blocker.

@volodya-lombrozo
Copy link
Member Author

volodya-lombrozo commented Dec 10, 2024

The order of part's doesn't matter

@yegor256
Copy link
Member

@volodya-lombrozo should be this:

<meta>
  <head>alias</head>
  <tail>seq jeo.seq</tail>
  <part>seq</part>
  <part>jeo.seq</part>
</meta>

This will be similar to this EO code (which is correct):

+alias seq jeo.seq

On a side note, I don't think you need this meta at all, since you use FQN in the @base attribute. The +alias meta is similar to import in Java. If you use FQN, no +alias is required.

@volodya-lombrozo
Copy link
Member Author

@yegor256 It's a requirement from you objectionary/jeo-maven-plugin#883

@yegor256
Copy link
Member

yegor256 commented Dec 10, 2024

@volodya-lombrozo it seems, I was wrong, sorry. Once the value of @base contains ., it is an FQN and you don't need an alias for it. Thus, I believe, you can remove all +alias metas from the XMIR you generate.

@maxonfjvipon please, confirm this

@maxonfjvipon
Copy link
Member

@yegor256 It seems that yes, you need alias only for the first object in dispatches chain:

+alias org.eolang.jeo

jeo.seq 

@volodya-lombrozo
Copy link
Member Author

@maxonfjvipon So, I can hardcode:

<meta>
  <head>alias</head>
  <tail>jeo org.eolang</tail>
  <part>jeo</part>
  <part>org.eolang</part>
</meta>

Or what?

@yegor256
Copy link
Member

@volodya-lombrozo you don't need any alias metas, just use FQNs in @base attributes (you're doing this already)

@yegor256 yegor256 added the bug Something isn't working label Dec 10, 2024
@yegor256 yegor256 self-assigned this Dec 10, 2024
@yegor256
Copy link
Member

@volodya-lombrozo does it work without meta? It should, I believe.

@volodya-lombrozo
Copy link
Member Author

@yegor256 I can't say anything before this PR is merged: objectionary/jeo-maven-plugin#942

@volodya-lombrozo
Copy link
Member Author

@volodya-lombrozo does it work without meta? It should, I believe.

@yegor256 Thank you for your suggestion! Removing meta elements seems to have resolved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants