This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 113322 - Editor API uses too much reflection
Summary: Editor API uses too much reflection
Status: RESOLVED WONTFIX
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Milutin Kristofic
URL:
Keywords: API
Depends on:
Blocks:
 
Reported: 2007-08-21 12:10 UTC by emi
Modified: 2016-07-07 07:28 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description emi 2007-08-21 12:10:53 UTC
The Editor API uses a lot of reflection. This makes code rather hard to read and it also adds another "hidden"
dependency layer next to normal .class / Lookup / Layer.xml dependencies and service declaration.

By reflection I also mean usage of the ClassLoader from the main Lookup and the "normal" reflection with Method
(getDeclaredMethod), Field (getDeclaredField()).

I did notice that some of the methods reached by reflection are expected to be moved in some friends API but a lot still
remain.

This doesn't apply just to the selected subcomponent but I can't seem to select more than one.
Comment 1 Vitezslav Stejskal 2007-08-21 13:07:49 UTC
Could you please identify the offending places? Also, are you really referring to 5.0 source base? If so, I would
suggest to look at the trunk sources. It's not that they would be better, but I don't see much point in analyzing
sources that are two releases old. Anyway, thanks for the effort, really.
Comment 2 emi 2007-08-21 17:45:55 UTC
No, my mistake, it's the 6.0 sources.

Basically just go in editor and do a grep on Lookup.getDefault().lookup(ClassLoader.class) for example. That's something
we shouldn't have at all. Also lots of usage of java.lang.reflect.Field/Method. I find it disturbing that after all
these ways to define services, etc. I still see reflection.
Comment 3 Vitezslav Stejskal 2007-08-22 11:30:15 UTC
Ok, I'll go through the sources and try to compile the list. I expect some of the occurrences could be there for
preserving backwards compatibility of old/deprecated stuff. But as you said, reflection should not be used in normal code.
Comment 4 Jiri Prox 2008-04-11 00:41:51 UTC
moving opened issues from TM <= 6.1 to TM=Dev
Comment 5 Martin Balin 2016-07-07 07:28:50 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss