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

ByteCodeType.forInstance() fails for instances of private/helper classes #39

Closed
GoogleCodeExporter opened this issue Mar 21, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

Using: as3commons-bytecode-0.9.8-SNAPSHOT.swc
       as3commons-reflect-1.3.5-SNAPSHOT.swc
       as3commons-lang-0.3.3-SNAPSHOT.swc

The following example code fails with a stack like this:

Error: A class with the name 'Test.as$0::Helper' could not be found.
    at org.as3commons.lang::ClassUtils$/forName()[C:\projects\as3-commons\as3-commons-lang\src\main\actionscript\org\as3commons\lang\ClassUtils.as:84]
    at org.as3commons.lang::ClassUtils$/forInstance()[C:\projects\as3-commons\as3-commons-lang\src\main\actionscript\org\as3commons\lang\ClassUtils.as:50]
    at org.as3commons.bytecode.reflect::ByteCodeType$/forInstance()[C:\projects\as3-commons\as3-commons-bytecode\src\main\actionscript\org\as3commons\bytecode\reflect\ByteCodeType.as:137]

You may want to refer to issue #36, which has been "fixed" and closed, for 
additional details.  However, the fix was directed at ByteCodeType.forName(), 
which doens't actually seem to be involved here.  Indeed, with the latest 
build, ByteCodeType.forInstance() is still failing.

---------------

// Test.as

package
{
    import org.as3commons.bytecode.reflect.ByteCodeType;

    public class Test extends Sprite
    {
        public function Test()
        {
            ByteCodeType.forInstance(new Helper()); // ERROR!
        }
    }
}

class Helper { }

Original issue reported on code.google.com by idontneedthisacct@gmail.com on 1 Feb 2011 at 1:36

@GoogleCodeExporter
Copy link
Author

Hmm, this is probably related to issue #38.

Original comment by idontneedthisacct@gmail.com on 3 Feb 2011 at 7:15

@GoogleCodeExporter
Copy link
Author

Yea, the forInstance will indeed fail because its not possible to retrieve the 
Class for it (getQualifiedName()) will fail), I think the only workaround will 
probably be to use ByteCodeType.forClass(Helper).
Hope this helps.

Original comment by ihatelivelyids on 26 Mar 2011 at 10:53

  • Changed state: WontFix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant