flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josh Tynjala (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FLEX-35300) Could not find file for class: Error
Date Thu, 27 Apr 2017 21:12:04 GMT
Josh Tynjala created FLEX-35300:
-----------------------------------

             Summary: Could not find file for class: Error
                 Key: FLEX-35300
                 URL: https://issues.apache.org/jira/browse/FLEX-35300
             Project: Apache Flex
          Issue Type: Bug
          Components: FalconJX
    Affects Versions: Apache FalconJX 0.8.0
            Reporter: Josh Tynjala


Create the following class and instantiate it with {{new CustomError()}}

{code:title=CustomError.as}
package
{
	public class CustomError extends Error
	{
	}
}
{code}

When you try to compile, the following error will appear in the output:

{code}
Could not find file for class: Error
File not found: Error
org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:366)org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:382)org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:391)org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:391)org.apache.flex.compiler.internal.graph.GoogDepsWriter.buildDB(GoogDepsWriter.java:206)org.apache.flex.compiler.internal.graph.GoogDepsWriter.getListOfFiles(GoogDepsWriter.java:96)org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSPublisher.publish(MXMLFlexJSPublisher.java:319)org.apache.flex.compiler.clients.MXMLJSCNode.compile(MXMLJSCNode.java:380)org.apache.flex.compiler.clients.MXMLJSCNode._mainNoExit(MXMLJSCNode.java:238)org.apache.flex.compiler.clients.MXMLJSCNode.mainNoExit(MXMLJSCNode.java:195)org.apache.flex.compiler.clients.MXMLJSC._mainNoExit(MXMLJSC.java:365)org.apache.flex.compiler.clients.MXMLJSC.mainNoExit(MXMLJSC.java:282)org.apache.flex.compiler.clients.MXMLJSC.staticMainNoExit(MXMLJSC.java:242)org.apache.flex.compiler.clients.MXMLJSC.main(MXMLJSC.java:224)
{code}

It appears to be related to the following code in GoogDepsWriter.java (and the section above
for {{@implements}} is probably also affected):

{code:Java}
c = line.indexOf("@extends");
if (c > -1)
{
	if (fi.impls == null)
		fi.impls = new ArrayList<String>();
	c2 = line.indexOf("}", c);
	String impl = line.substring(c + 10, c2);
	fi.impls.add(impl);
}
{code}

Using NativeUtils.isJSNative() seems to help for this particular case with the Error class:

{code:Java}
c = line.indexOf("@extends");
if (c > -1)
{
	if (fi.impls == null)
		fi.impls = new ArrayList<String>();
	c2 = line.indexOf("}", c);
	String impl = line.substring(c + 10, c2);
	if(!NativeUtils.isJSNative(impl))
	{
		fi.impls.add(impl);
	}
}
{code}

I'm don't think that this is the correct solution, though. Other classes defined in externs
can also give us this error and return false for isJSNative(). For instance, I randomly tried
extending child_process.ChildProcess from node.swc, and I got the same error.

{code}
Could not find file for class: child_process.ChildProcess
File not found: child_process.ChildProcess
org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:367)org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:383)org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:392)org.apache.flex.compiler.internal.graph.GoogDepsWriter.buildDB(GoogDepsWriter.java:207)org.apache.flex.compiler.internal.graph.GoogDepsWriter.getListOfFiles(GoogDepsWriter.java:97)org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSPublisher.publish(MXMLFlexJSPublisher.java:319)org.apache.flex.compiler.clients.MXMLJSCNode.compile(MXMLJSCNode.java:380)org.apache.flex.compiler.clients.MXMLJSCNode._mainNoExit(MXMLJSCNode.java:238)org.apache.flex.compiler.clients.MXMLJSCNode.mainNoExit(MXMLJSCNode.java:195)org.apache.flex.compiler.clients.MXMLJSC._mainNoExit(MXMLJSC.java:365)org.apache.flex.compiler.clients.MXMLJSC.mainNoExit(MXMLJSC.java:282)org.apache.flex.compiler.clients.MXMLJSC.staticMainNoExit(MXMLJSC.java:242)org.apache.flex.compiler.clients.MXMLJSC.main(MXMLJSC.java:224)
{code}

Something more robust than NativeUtils.isJSNative() that accounts for whether the class is
extern seems required here.

This issue was not present in FlexJS 0.7.0.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message