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

Invalid URL in compilation error #505

Closed
bwilkerson opened this issue Nov 17, 2011 · 4 comments
Closed

Invalid URL in compilation error #505

bwilkerson opened this issue Nov 17, 2011 · 4 comments
Labels
closed-duplicate Closed in favor of an existing report

Comments

@bwilkerson
Copy link
Member

In the editor, create a new application named "testing" and replaced the contents of testing.dart with the following:


import('dart:html');

class InvalidErrorTest {

 InvalidErrorTest() {
 }

 void run() {
   write("Hello World!"); // <== Invalid error shows up on this line
 }

 void write(String message) {
   // the HTML library defines a global "document" variable
   document.query('#status').innerHTML = message;
 }
}

void main() {
 new InvalidErrorTest().run();
}

class ClassWithInvalidCode {

 get foo; // <== add/delete semi-colon then save
 set foo;

}


There are compilation errors associated with the get and set methods that are being reported correctly. However, if you then delete the semicolon on line 9, a compilation error is generated that has an invalid URL, as evidenced by the following log entry. Note that the file name (obtained by "error.getSource().getUri().toString()") is duplicated.


!ENTRY com.google.dart.tools.core 1 0 2011-11-17 11:26:32.635
!MESSAGE INFO: Could not find file for source "file:/Users/brianwilkerson/dart/testing/testing.dart/testing.dart" (1): Illegal number of parameters
!STACK 0
java.lang.RuntimeException: Could not find file for source "file:/Users/brianwilkerson/dart/testing/testing.dart/testing.dart" (1): Illegal number of parameters
    at com.google.dart.tools.core.internal.builder.CompilerListener.getResource(CompilerListener.java:139)
    at com.google.dart.tools.core.internal.builder.CompilerListener.processError(CompilerListener.java:161)
    at com.google.dart.tools.core.internal.builder.CompilerListener.onError(CompilerListener.java:77)
    at com.google.dart.compiler.DartCompilerMainContext.onError(DartCompilerMainContext.java:62)
    at com.google.dart.compiler.parser.DartScannerParserContext.error(DartScannerParserContext.java:121)
    at com.google.dart.compiler.parser.AbstractParser.reportError(AbstractParser.java:98)
    at com.google.dart.compiler.parser.DartParser.parseMethod(DartParser.java:985)
    at com.google.dart.compiler.parser.DartParser.parseMethodOrAccessor(DartParser.java:1050)
    at com.google.dart.compiler.parser.DartParser.parseFieldOrMethod(DartParser.java:836)
    at com.google.dart.compiler.parser.DartParser.parseClass(DartParser.java:528)
    at com.google.dart.compiler.parser.DartParser.parseUnit(DartParser.java:256)
    at com.google.dart.compiler.ast.LibraryUnit.parseApiUnit(LibraryUnit.java:435)
    at com.google.dart.compiler.ast.LibraryUnit.loadApi(LibraryUnit.java:269)
    at com.google.dart.compiler.DartCompiler$Compiler.parseOutOfDateFiles(DartCompiler.java:247)
    at com.google.dart.compiler.DartCompiler$Compiler.updateAndResolve(DartCompiler.java:203)
    at com.google.dart.compiler.DartCompiler$Compiler.compile(DartCompiler.java:168)
    at com.google.dart.compiler.DartCompiler$Compiler.access$3(DartCompiler.java:165)
    at com.google.dart.compiler.DartCompiler.compileLib(DartCompiler.java:1121)
    at com.google.dart.compiler.DartCompiler.compileLib(DartCompiler.java:1097)
    at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.secureCompileLib(DartCompilerUtilities.java:737)
    at com.google.dart.tools.core.internal.builder.DartBuilder.buildLibrary(DartBuilder.java:356)
    at com.google.dart.tools.core.internal.builder.DartBuilder.buildAllApplications(DartBuilder.java:275)
    at com.google.dart.tools.core.internal.builder.DartBuilder.build(DartBuilder.java:249)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


@bwilkerson
Copy link
Member Author

Are we making progress on this issue? This is causing serious usability problems in Editor.

@DartBot
Copy link

DartBot commented Jan 4, 2012

This comment was originally written by [email protected]


Any luck in coming up with a repro case for this?

The filename being duplicated is correct if we assume that the URI ought to be:
dart:/Users/brianwilkerson/dart/testing/testing.dart/testing.dart

instead of:
file:..

There are dozens of places where a class that implements Source is defined, so it isn't obvious to me where this might be coming from by visual inspection.

@bwilkerson
Copy link
Member Author

When I said "Note that the file name (obtained by "error.getSource().getUri().toString()") is duplicated.", I was referring to the last segment of the file path "testing.dart".

Given that this is a user-created file rather than a Dart-supplied file, I don't think that the "dart" scheme would be appropriate here.

I'm guessing that this is a duplicate of 590, so I'm marking it as such. Konstantin is working on a fix for this in http://codereview.chromium.org/8898001/.


Added Duplicate label.
Marked as being merged into #590.

@DartBot
Copy link

DartBot commented Jan 5, 2012

This comment was originally written by [email protected]


Even if this were a file from the local disk, this is just a normal, expected part of the URL scheme for the dart: URL protocol.

The 'duplicated' name at the end is first the library name, then the file name when used in a 'dart:' url scheme. I say this just by way of explanation. I agree that we could represent this resource with a file: url as well, but it wouldn't be consistent with what we do elsewhere.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report
Projects
None yet
Development

No branches or pull requests

2 participants