Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 249627 Details for
Bug 455852
Eclipse formatter does not obey wrap width limits in some cases
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
Another example
Test.java (text/x-java), 1.49 KB, created by
Luke Hutchison
on 2014-12-26 03:06:25 EST
(
hide
)
Description:
Another example
Filename:
MIME Type:
Creator:
Luke Hutchison
Created:
2014-12-26 03:06:25 EST
Size:
1.49 KB
patch
obsolete
>import java.lang.annotation.Annotation; >import java.lang.annotation.ElementType; >import java.lang.annotation.Retention; >import java.lang.annotation.RetentionPolicy; >import java.lang.annotation.Target; >import java.lang.reflect.Field; > >public class Test { > > @Retention(RetentionPolicy.RUNTIME) > @Target(ElementType.FIELD) > public static @interface Required { > } > > public static class X { > @Required > String id; > > int index; > } > > public static void test(Class<? extends X> klass) { > for (Field field : klass.getFields()) { > if (field.isAccessible()) { > for (Annotation annotation : field.getAnnotations()) { > Class<?> fieldType = field.getType(); > // ----------------------------------------------------------------------max wrap width: 120-------| > if (annotation.annotationType() == Required.class > && (fieldType == Integer.TYPE || fieldType == Long.TYPE || fieldType == Short.TYPE > || fieldType == Character.TYPE || fieldType == Byte.TYPE || fieldType == Float.TYPE || fieldType == Double.TYPE)) { > throw new RuntimeException("Field " + klass.getName() + "." + field.getName() > + " has a Required annotation, but the field has a primitive type," > + " so it can never be null"); > } > } > } > } > } >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 455852
:
249565
| 249627