Comments (5)
Clarification...
Actually, Type/ByteCodeType.forClass() does work! But,
Type/ByteCodeType.forInstance() fails (which is actually what I was
encountering in my real code).
Also, I think I see the possible cause...
The information returned by forClass shows that the fullName of Helper is
"Test.as$0.Helper". But, the Error thrown by forInstance complains about not
being able to find a class named "Test.as$0::Helper".
So, the issue might be that the library is using "::" instead of "." somewhere?
Revised example:
------------
// Test.as
package
{
import org.as3commons.bytecode.reflect.ByteCodeType;
public class Test extends Sprite
{
public function Test()
{
var t:ByteCodeType = ByteCodeType.forClass(Helper); // OK
ByteCodeType.forName(t.fullName); // OK
trace(t.fullName); // "Test.as$0.Helper"
ByteCodeType.forInstance(new Helper()); // ERROR!
}
}
}
class Helper { }
Original comment by [email protected]
on 27 Jan 2011 at 8:58
from as3-commons.
Btw, for now, to avoid the ByteCodeType.forInstance failures on private/helper
classes, I am using the following work-around:
function byteCodeTypeForInstance(inst:*):ByteCodeType
{
var name:String = StringUtil.replace(getQualifiedClassName(inst), "::", ".");
return ByteCodeType.forName(name);
}
This seems to work for instances of any class.
Original comment by [email protected]
on 27 Jan 2011 at 9:56
from as3-commons.
Thanks for bringing this up, the ByteCodeType.forName() will now first
normalize the class name before trying to retrieve it from the cache.
Original comment by ihatelivelyids
on 28 Jan 2011 at 12:05
- Changed state: Fixed
from as3-commons.
What version will this fix appear in?
I am currently using...
as3commons-reflect-1.3.4.swc
as3commons-bytecode-0.9.7.swc
but ByteCodeType.forInstance() is still failing I as described in my previous
comments.
Original comment by [email protected]
on 31 Jan 2011 at 11:07
from as3-commons.
I made some modifications in the trunk, (which I didn't test thoroughly I
readily admit), ByteCodeType.forClass() now checks if the clazz property is
null after retrieving it from the cache, if its null (in the case of private
classes) it will just assign the Class instance that was passed into the
forClass() method the the clazz property of the specified ByteCodeType instance.
This fix will appear in the next release.
Original comment by [email protected]
on 16 Mar 2011 at 10:01
from as3-commons.
Related Issues (20)
- No match for Opcode: 0xbb (187) HOT 3
- Error #2030: (EOF) HOT 3
- Error #1125: The index 1073741823 is out of range 210 while reading file HOT 3
- [Feature Request] HOT 4
- Vector class name truncated
- Type Coercion failed: Array to Vector.<Op> and Array to Vector.<JumpTargetData> HOT 2
- Invalid parsing of string operand when defining method body from source string.
- Error #1034: Ошибка типа Coercion: невозможно преобразовать org.as3commons.bytecode.abc::Multiname@af8a541 в org.as3commons.bytecode.abc.QualifiedName.
- Can't create class members of type Vector.<T>
- Class org.as3commons.logging::ILogger could not be found. HOT 1
- Bug in log4j configuration HOT 1
- equals and equalsIgnoreCase are both using regex improperly HOT 1
- Chainsaw gateway generates malformed XML
- ArrayUtils.shuffle algorithm results in a biased shuffle HOT 1
- NPE when ByteCodeType.fromLoader is invoked in an empty Application HOT 1
- MethodBuilder.addAsmSource() #1034 conversion error
- On method body definition, #1065 error accessing private or protected property
- Ability to get abcBytes position from DoABC tag
- as3commons-bytecode - issue creating metadata against accessors
- AirFileTarget set timezone HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from as3-commons.