Redian新闻
>
anonymous innerclass reflection question
avatar
anonymous innerclass reflection question# Java - 爪哇娇娃
z*n
1
第三条第二款
第三条 本法规定的垄断行为包括:
(一)经营者达成垄断协议;
(二)经营者滥用市场支配地位;
(三)具有或者可能具有排除、限制竞争效果的经营者集中。
avatar
c*k
2
Hi, I got the following exception when running the codes attached below:
Exception in thread "main" java.lang.InstantiationException: IFactory$1
at java.lang.Class.newInstance0(Class.java:281)
at java.lang.Class.newInstance(Class.java:249)
at IFactory.getI(IFactory.java:20)
at IFactory.main(IFactory.java:35)
Is it because Java doesn't support reflection for anonymous inner class? If
so, how can I have dynamic classes? Is it possible?
Thanks in advance.
Gary
import
avatar
i*n
3
in china law is just joke, is bitch.
avatar
n*k
4

Does this have anything to do the famous reflection error, you must have a
default public constructor, in order to use class.newInstance() method.

【在 c********k 的大作中提到】
: Hi, I got the following exception when running the codes attached below:
: Exception in thread "main" java.lang.InstantiationException: IFactory$1
: at java.lang.Class.newInstance0(Class.java:281)
: at java.lang.Class.newInstance(Class.java:249)
: at IFactory.getI(IFactory.java:20)
: at IFactory.main(IFactory.java:35)
: Is it because Java doesn't support reflection for anonymous inner class? If
: so, how can I have dynamic classes? Is it possible?
: Thanks in advance.
: Gary

avatar
m*s
5
这是闹大 了,对QQ不好,
avatar
e*g
6
it does'nt make sense. anonym. inner class needs access to parent object, even
local variables, how could it be created outside the scope it is defined.
use static public nested class.

【在 c********k 的大作中提到】
: Hi, I got the following exception when running the codes attached below:
: Exception in thread "main" java.lang.InstantiationException: IFactory$1
: at java.lang.Class.newInstance0(Class.java:281)
: at java.lang.Class.newInstance(Class.java:249)
: at IFactory.getI(IFactory.java:20)
: at IFactory.main(IFactory.java:35)
: Is it because Java doesn't support reflection for anonymous inner class? If
: so, how can I have dynamic classes? Is it possible?
: Thanks in advance.
: Gary

avatar
L*3
7
QQ is a free software..
avatar
m*t
8

IMO,this problem is caused by that any non-static inner class does
not have a default constructor(i.e. an argumentless one).
They always have a constructor that takes a reference to the
enclosing instance.
There is no way you can do the thing you are trying to
do in the way you are doing it now. 8-) I think you are doing things
in Java with some COM mentality. Dynamic Proxy is probably what
you are looking for...

【在 c********k 的大作中提到】
: Hi, I got the following exception when running the codes attached below:
: Exception in thread "main" java.lang.InstantiationException: IFactory$1
: at java.lang.Class.newInstance0(Class.java:281)
: at java.lang.Class.newInstance(Class.java:249)
: at IFactory.getI(IFactory.java:20)
: at IFactory.main(IFactory.java:35)
: Is it because Java doesn't support reflection for anonymous inner class? If
: so, how can I have dynamic classes? Is it possible?
: Thanks in advance.
: Gary

avatar
c*3
9
是的,免费软件应该没有这个问题
所以只要国内的人不嫌麻烦换个软件就可以了
腾讯做这个决定是很霸道也有风险,搞得不好会把自己赔进去
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。