You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[23] Flow analysis fails to recognize initialization in an instance initializer block (eclipse-jdt#3749)
+ arguments to explicit constructor call are prologue
- if they are relevant don't skip prologue analysis
+ fine tune creation and usage of flow prologueInfo
Fixeseclipse-jdt#3748
Copy file name to clipboardexpand all lines: org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java
Copy file name to clipboardexpand all lines: org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SuperAfterStatementsTest.java
+83
Original file line number
Diff line number
Diff line change
@@ -3137,4 +3137,87 @@ public static void main(String... args) {
3137
3137
},
3138
3138
"1");
3139
3139
}
3140
+
3141
+
publicvoidtestGH3748a() {
3142
+
runNegativeTest(newString[] {
3143
+
"X.java",
3144
+
"""
3145
+
public class X {
3146
+
final int fin1, fin2;
3147
+
{
3148
+
fin1 = 0;
3149
+
fin2 = 1;
3150
+
}
3151
+
X() {
3152
+
int abc = 0; // Commenting out this line brings out the error
3153
+
this(fin1 = 10);
3154
+
fin2 = 11;
3155
+
}
3156
+
X(int x) {}
3157
+
}
3158
+
"""
3159
+
},
3160
+
"""
3161
+
----------
3162
+
1. ERROR in X.java (at line 4)
3163
+
fin1 = 0;
3164
+
^^^^
3165
+
The final field fin1 may already have been assigned
3166
+
----------
3167
+
2. WARNING in X.java (at line 9)
3168
+
this(fin1 = 10);
3169
+
^^^^^^^^^^^^^^^^
3170
+
You are using a preview language feature that may or may not be supported in a future release
3171
+
----------
3172
+
3. WARNING in X.java (at line 9)
3173
+
this(fin1 = 10);
3174
+
^^^^
3175
+
You are using a preview language feature that may or may not be supported in a future release
3176
+
----------
3177
+
4. ERROR in X.java (at line 10)
3178
+
fin2 = 11;
3179
+
^^^^
3180
+
The final field fin2 may already have been assigned
3181
+
----------
3182
+
""");
3183
+
}
3184
+
3185
+
publicvoidtestGH3748b() {
3186
+
runNegativeTest(newString[] {
3187
+
"X.java",
3188
+
"""
3189
+
public class X {
3190
+
final int fin1;
3191
+
final int fin2;
3192
+
{
3193
+
fin1 = 0;
3194
+
fin2 = 1;
3195
+
}
3196
+
X() {
3197
+
this(fin1 = 10);
3198
+
fin2 = 11;
3199
+
}
3200
+
X(int x) {}
3201
+
}
3202
+
"""
3203
+
},
3204
+
"""
3205
+
----------
3206
+
1. ERROR in X.java (at line 5)
3207
+
fin1 = 0;
3208
+
^^^^
3209
+
The final field fin1 may already have been assigned
3210
+
----------
3211
+
2. WARNING in X.java (at line 9)
3212
+
this(fin1 = 10);
3213
+
^^^^
3214
+
You are using a preview language feature that may or may not be supported in a future release
3215
+
----------
3216
+
3. ERROR in X.java (at line 10)
3217
+
fin2 = 11;
3218
+
^^^^
3219
+
The final field fin2 may already have been assigned
0 commit comments