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] [Commented] (FLEX-35300) Could not find file for class: Error
Date Thu, 27 Apr 2017 21:33:04 GMT

    [ https://issues.apache.org/jira/browse/FLEX-35300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15987732#comment-15987732
] 

Josh Tynjala commented on FLEX-35300:
-------------------------------------

There is no goog.require for Error. I've pasted the JS below.

If I understand the code for GoogDepsWriter, it's detecting the class from @extends \{Error\}
in the JSDoc rather than from a goog.require().

{code:title=CustomError.js}
/**
 * Generated by Apache Flex Cross-Compiler from CustomError.as
 * CustomError
 *
 * @fileoverview
 *
 * @suppress {checkTypes|accessControls}
 */

goog.provide('CustomError');
goog.require('org.apache.flex.utils.Language');



/**
 * @constructor
 * @extends {Error}
 */
CustomError = function() {
  CustomError.base(this, 'constructor');
};
goog.inherits(CustomError, Error);


/**
 * Metadata
 *
 * @type {Object.<string, Array.<Object>>}
 */
CustomError.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'CustomError', qName: 'CustomError'}]
};


/**
 * Prevent renaming of class. Needed for reflection.
 */
goog.exportSymbol('CustomError', CustomError);



/**
 * Reflection
 *
 * @return {Object.<string, Function>}
 */
CustomError.prototype.FLEXJS_REFLECTION_INFO = function () {
  return {
    variables: function () {
      return {
      };
    },
    accessors: function () {
      return {
      };
    },
    methods: function () {
      return {
      };
    }
  };
};

//# sourceMappingURL=./CustomError.js.map
{code}

> 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 compiler 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 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. The issue exists in both the develop and
dual branches.



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

Mime
View raw message