~ubuntu-branches/ubuntu/wily/aspectj/wily-proposed

« back to all changes in this revision

Viewing changes to org.aspectj/modules/bridge/src/org/aspectj/bridge/IMessage.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2011-03-15 23:54:31 UTC
  • mfrom: (1.2.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20110315235431-iq2gxbsx08kpwuiw
* New upstream release.
* Updated Standards-Version to 3.9.1 (no changes needed).
* Fix local Javadoc links:
  - d/patches/07_javadoc_links.diff: Use locally installed
   javadoc packages and hyperlink with them.
  - d/control: Add B-D on default-java-doc and libasm3-java-doc.
* d/control: Drop B-D on itself (our new bootstrap infrastructure doesn't need
  that anymore).
* Split packages into :
  - aspectj: only contains CLI tools.
  - libaspectj-java: JAR librairies for /usr/share/java.
  - libaspectj-java-doc: 4 API's Javadoc.
  - aspectj-doc: Programming Guides and SDK Documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 *     Xerox/PARC     initial implementation 
12
12
 * ******************************************************************/
13
13
 
14
 
 
15
14
package org.aspectj.bridge;
16
15
 
17
16
import java.util.Arrays;
20
19
import java.util.List;
21
20
 
22
21
/**
23
 
  * Wrap message with any associated throwable or source location.
24
 
  */
 
22
 * Wrap message with any associated throwable or source location.
 
23
 */
25
24
public interface IMessage {
26
25
        /** no messages */
27
26
        public static final IMessage[] RA_IMessage = new IMessage[0];
28
27
 
29
28
        // int values must sync with KINDS order below
30
 
        public static final Kind WEAVEINFO = new Kind("weaveinfo",5);
 
29
        public static final Kind WEAVEINFO = new Kind("weaveinfo", 5);
31
30
        public static final Kind INFO = new Kind("info", 10);
32
31
        public static final Kind DEBUG = new Kind("debug", 20);
33
 
        public static final Kind TASKTAG = new Kind("task",25); // represents a 'TODO' from eclipse - producted by the compiler and consumed by AJDT
 
32
        public static final Kind TASKTAG = new Kind("task", 25); // represents a 'TODO' from eclipse - producted by the compiler and
 
33
                                                                                                                                // consumed by AJDT
34
34
        public static final Kind WARNING = new Kind("warning", 30);
35
35
        public static final Kind ERROR = new Kind("error", 40);
36
36
        public static final Kind FAIL = new Kind("fail", 50);
37
37
        public static final Kind ABORT = new Kind("abort", 60);
38
38
        // XXX prefer another Kind to act as selector for "any",
39
39
        // but can't prohibit creating messages with it.
40
 
        //public static final Kind ANY = new Kind("any-selector", 0);
 
40
        // public static final Kind ANY = new Kind("any-selector", 0);
41
41
 
42
 
        /** list of Kind in precedence order. 0 is less than 
43
 
         * IMessage.Kind.COMPARATOR.compareTo(KINDS.get(i), KINDS.get(i + 1))
 
42
        /**
 
43
         * list of Kind in precedence order. 0 is less than IMessage.Kind.COMPARATOR.compareTo(KINDS.get(i), KINDS.get(i + 1))
44
44
         */
45
 
        public static final List KINDS =
46
 
                Collections.unmodifiableList(
47
 
                        Arrays.asList(
48
 
                                new Kind[] { WEAVEINFO, INFO, DEBUG, TASKTAG, WARNING, ERROR, FAIL, ABORT }));
 
45
        public static final List<Kind> KINDS = Collections.unmodifiableList(Arrays.asList(new Kind[] { WEAVEINFO, INFO, DEBUG, TASKTAG,
 
46
                        WARNING, ERROR, FAIL, ABORT }));
49
47
 
50
48
        /** @return non-null String with simple message */
51
49
        String getMessage();
62
60
        /** @return true if this is an internal debug message */
63
61
        boolean isDebug();
64
62
 
65
 
        /** @return true if this is information for the user  */
 
63
        /** @return true if this is information for the user */
66
64
        boolean isInfo();
67
65
 
68
 
        /** @return true if the process is aborting  */
 
66
        /** @return true if the process is aborting */
69
67
        boolean isAbort(); // XXX ambiguous
70
68
 
71
69
        /** @return true if this is a task tag message */
72
70
        boolean isTaskTag();
73
 
        
74
 
        /** @return true if something failed   */
 
71
 
 
72
        /** @return true if something failed */
75
73
        boolean isFailed();
76
74
 
77
75
        /** Caller can verify if this message came about because of a DEOW */
78
76
        boolean getDeclared();
79
 
        
 
77
 
80
78
        /** Return the ID of the message where applicable, see IProblem for list of valid IDs */
81
79
        int getID();
82
 
        
 
80
 
83
81
        /** Return the start position of the problem (inclusive), or -1 if unknown. */
84
82
        int getSourceStart();
85
 
        
 
83
 
86
84
        /** Return the end position of the problem (inclusive), or -1 if unknown. */
87
85
        int getSourceEnd();
88
 
        
 
86
 
89
87
        /** @return Throwable associated with this message, or null if none */
90
88
        Throwable getThrown();
91
89
 
92
90
        /** @return source location associated with this message, or null if none */
93
91
        ISourceLocation getSourceLocation();
94
92
 
95
 
        public static final class Kind implements Comparable {
96
 
                public static final Comparator COMPARATOR = new Comparator() {
97
 
                        public int compare(Object o1, Object o2) {
98
 
                                Kind one = (Kind) o1;
99
 
                                Kind two = (Kind) o2;
 
93
        public static final class Kind implements Comparable<IMessage.Kind> {
 
94
                public static final Comparator<IMessage.Kind> COMPARATOR = new Comparator<IMessage.Kind>() {
 
95
                        public int compare(IMessage.Kind one, IMessage.Kind two) {
100
96
                                if (null == one) {
101
97
                                        return (null == two ? 0 : -1);
102
98
                                } else if (null == two) {
108
104
                                }
109
105
                        }
110
106
                };
111
 
        
112
 
        /**
113
 
         * @param kind the Kind floor
114
 
         * @return false if kind is null or this
115
 
         *         has less precedence than kind,
116
 
         *         true otherwise.
117
 
         */
 
107
 
 
108
                /**
 
109
                 * @param kind the Kind floor
 
110
                 * @return false if kind is null or this has less precedence than kind, true otherwise.
 
111
                 */
118
112
                public boolean isSameOrLessThan(Kind kind) {
119
 
            return (0 >= COMPARATOR.compare(this, kind));
 
113
                        return (0 >= COMPARATOR.compare(this, kind));
120
114
                }
121
 
        
122
 
                public int compareTo(Object other) {
 
115
 
 
116
                public int compareTo(IMessage.Kind other) {
123
117
                        return COMPARATOR.compare(this, other);
124
118
                }
125
119
 
130
124
                        this.name = name;
131
125
                        this.precedence = precedence;
132
126
                }
 
127
 
133
128
                public String toString() {
134
129
                        return name;
135
130
                }
136
131
        }
137
132
 
138
133
        /**
139
 
         * @return      Detailed information about the message. For example, for declare 
140
 
         * error/warning messages this returns information about the corresponding 
141
 
         * join point's static part. 
 
134
         * @return Detailed information about the message. For example, for declare error/warning messages this returns information
 
135
         *         about the corresponding join point's static part.
142
136
         */
143
137
        public String getDetails();
144
 
    
145
 
        
146
 
        /** 
147
 
         * @return List of <code>ISourceLocation</code> instances that indicate 
148
 
         * additional source locations relevent to this message as specified by the 
149
 
         * message creator. The list should not include the primary source location 
150
 
         * associated with the message which can be obtained from 
151
 
         * <code>getSourceLocation()<code>. 
 
138
 
 
139
        /**
 
140
         * @return List of <code>ISourceLocation</code> instances that indicate additional source locations relevent to this message as
 
141
         *         specified by the message creator. The list should not include the primary source location associated with the message
 
142
         *         which can be obtained from <code>getSourceLocation()<code>. 
152
143
         * <p>   
153
144
         * An example of using extra locations would be in a warning message that 
154
145
         * flags all shadow locations that will go unmatched due to a pointcut definition 
155
 
         * being based on a subtype of a defining type. 
156
 
         * @see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=41952">AspectJ bug 41952</a> 
157
 
         */ 
158
 
    public List getExtraSourceLocations();
 
146
         * being based on a subtype of a defining type.
 
147
         * @see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=41952">AspectJ bug 41952</a>
 
148
         */
 
149
        public List<ISourceLocation> getExtraSourceLocations();
159
150
}