Lines 34-39
Link Here
|
34 |
|
34 |
|
35 |
public ReferenceBinding[] handledExceptions; |
35 |
public ReferenceBinding[] handledExceptions; |
36 |
int[] isReached; |
36 |
int[] isReached; |
|
|
37 |
int[] clearUnusedDeclaredThrownExceptionWarning; |
37 |
int[] isNeeded; |
38 |
int[] isNeeded; |
38 |
UnconditionalFlowInfo[] initsOnExceptions; |
39 |
UnconditionalFlowInfo[] initsOnExceptions; |
39 |
ObjectCache indexes = new ObjectCache(); |
40 |
ObjectCache indexes = new ObjectCache(); |
Lines 56-78
Link Here
|
56 |
this.handledExceptions = handledExceptions; |
57 |
this.handledExceptions = handledExceptions; |
57 |
int count = handledExceptions.length, cacheSize = (count / ExceptionHandlingFlowContext.BitCacheSize) + 1; |
58 |
int count = handledExceptions.length, cacheSize = (count / ExceptionHandlingFlowContext.BitCacheSize) + 1; |
58 |
this.isReached = new int[cacheSize]; // none is reached by default |
59 |
this.isReached = new int[cacheSize]; // none is reached by default |
|
|
60 |
this.clearUnusedDeclaredThrownExceptionWarning = new int[cacheSize]; // none is reached by default |
59 |
this.isNeeded = new int[cacheSize]; // none is needed by default |
61 |
this.isNeeded = new int[cacheSize]; // none is needed by default |
60 |
this.initsOnExceptions = new UnconditionalFlowInfo[count]; |
62 |
this.initsOnExceptions = new UnconditionalFlowInfo[count]; |
61 |
boolean reachUnchecked = !scope.compilerOptions(). |
|
|
62 |
reportUnusedDeclaredThrownExceptionIncludeUncheckedExceptions; |
63 |
for (int i = 0; i < count; i++) { |
63 |
for (int i = 0; i < count; i++) { |
64 |
this.indexes.put(handledExceptions[i], i); // key type -> value index |
64 |
this.indexes.put(handledExceptions[i], i); // key type -> value index |
65 |
int cacheIndex = i / ExceptionHandlingFlowContext.BitCacheSize, bitMask = 1 << (i % ExceptionHandlingFlowContext.BitCacheSize); |
|
|
66 |
if (handledExceptions[i].isUncheckedException(true)) { |
65 |
if (handledExceptions[i].isUncheckedException(true)) { |
67 |
if (reachUnchecked) { |
66 |
this.isReached[i / ExceptionHandlingFlowContext.BitCacheSize] |= 1 << (i % ExceptionHandlingFlowContext.BitCacheSize); |
68 |
this.isReached[cacheIndex] |= bitMask; |
|
|
69 |
} |
70 |
this.initsOnExceptions[i] = flowInfo.unconditionalCopy(); |
67 |
this.initsOnExceptions[i] = flowInfo.unconditionalCopy(); |
71 |
} else { |
68 |
} else { |
72 |
this.initsOnExceptions[i] = FlowInfo.DEAD_END; |
69 |
this.initsOnExceptions[i] = FlowInfo.DEAD_END; |
73 |
} |
70 |
} |
74 |
} |
71 |
} |
75 |
System.arraycopy(this.isReached, 0, this.isNeeded, 0, cacheSize); |
72 |
System.arraycopy(this.isReached, 0, this.isNeeded, 0, cacheSize); |
|
|
73 |
if (!scope.compilerOptions().reportUnusedDeclaredThrownExceptionIncludeUncheckedExceptions) { |
74 |
System.arraycopy(this.isReached, 0, this.clearUnusedDeclaredThrownExceptionWarning, 0, cacheSize); |
75 |
} |
76 |
this.initsOnReturn = FlowInfo.DEAD_END; |
76 |
this.initsOnReturn = FlowInfo.DEAD_END; |
77 |
} |
77 |
} |
78 |
|
78 |
|
Lines 101-107
Link Here
|
101 |
int index = this.indexes.get(this.handledExceptions[i]); |
101 |
int index = this.indexes.get(this.handledExceptions[i]); |
102 |
int cacheIndex = index / ExceptionHandlingFlowContext.BitCacheSize; |
102 |
int cacheIndex = index / ExceptionHandlingFlowContext.BitCacheSize; |
103 |
int bitMask = 1 << (index % ExceptionHandlingFlowContext.BitCacheSize); |
103 |
int bitMask = 1 << (index % ExceptionHandlingFlowContext.BitCacheSize); |
104 |
if ((this.isReached[cacheIndex] & bitMask) == 0) { |
104 |
if ((this.clearUnusedDeclaredThrownExceptionWarning[cacheIndex] & bitMask) == 0) { |
105 |
for (int j = 0; j < docCommentReferencesLength; j++) { |
105 |
for (int j = 0; j < docCommentReferencesLength; j++) { |
106 |
if (docCommentReferences[j] == this.handledExceptions[i]) { |
106 |
if (docCommentReferences[j] == this.handledExceptions[i]) { |
107 |
continue nextHandledException; |
107 |
continue nextHandledException; |
Lines 214-219
Link Here
|
214 |
this.isNeeded[cacheIndex] |= bitMask; |
214 |
this.isNeeded[cacheIndex] |= bitMask; |
215 |
} |
215 |
} |
216 |
this.isReached[cacheIndex] |= bitMask; |
216 |
this.isReached[cacheIndex] |= bitMask; |
|
|
217 |
this.clearUnusedDeclaredThrownExceptionWarning[cacheIndex] |= bitMask; |
217 |
|
218 |
|
218 |
this.initsOnExceptions[index] = |
219 |
this.initsOnExceptions[index] = |
219 |
(this.initsOnExceptions[index].tagBits & FlowInfo.UNREACHABLE) == 0 ? |
220 |
(this.initsOnExceptions[index].tagBits & FlowInfo.UNREACHABLE) == 0 ? |