-
Bug
-
Resolution: Fixed
-
P3
-
8u5, 8u11
-
b31
-
x86
-
windows_8
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8085395 | emb-9 | Maurizio Cimadamore | P3 | Resolved | Fixed | team |
JDK-8064052 | 8u45 | Maurizio Cimadamore | P3 | Resolved | Fixed | b01 |
JDK-8058094 | 8u40 | Maurizio Cimadamore | P3 | Resolved | Fixed | b06 |
JDK-8070272 | emb-8u47 | Maurizio Cimadamore | P3 | Resolved | Fixed | team |
FULL PRODUCT VERSION :
1.8.0_05
ADDITIONAL OS VERSION INFORMATION :
Windows 8.1 Update 1 (6.3.9600)
A DESCRIPTION OF THE PROBLEM :
When passing an array to a non-static method that takes in varargs of the same type from a static context, the error message says something like:
method methodName in class Clazz cannot be applied to given types;
required: Object[]
found: Object[]
reason: varargs mismatch; Object[] cannot be converted to Object
This can impede progress because it does not accurately describe the issue at hand
REGRESSION. Last worked in version 6u45
ADDITIONAL REGRESSION INFORMATION:
1.8.0_05, 1.8.0_11 both produce this bug. Higher versions not tested, some lower versions tested and do not produce this.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
https://stackoverflow.com/revisions/25394998/1
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Something similar to the following error message is given:
non-static method methodName(Object...) cannot be referenced from a static context
ACTUAL -
Something similar to the following error message is given:
method methodName in class Clazz cannot be applied to given types;
required: Object[]
found: Object[]
reason: varargs mismatch; Object[] cannot be converted to Object
ERROR MESSAGES/STACK TRACES THAT OCCUR :
method methodName in class Clazz cannot be applied to given types;
required: Object[]
found: Object[]
reason: varargs mismatch; Object[] cannot be converted to Object
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class PrimitiveVarArgs
{
public static void main(String[] args)
{
int[] ints = new int[]{1, 2, 3, 4, 5};
prints(ints);
}
void prints(int... ints)
{
for(int i : ints)
System.out.println(i);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
add "static" to the non-static method and pretend the error never happened
1.8.0_05
ADDITIONAL OS VERSION INFORMATION :
Windows 8.1 Update 1 (6.3.9600)
A DESCRIPTION OF THE PROBLEM :
When passing an array to a non-static method that takes in varargs of the same type from a static context, the error message says something like:
method methodName in class Clazz cannot be applied to given types;
required: Object[]
found: Object[]
reason: varargs mismatch; Object[] cannot be converted to Object
This can impede progress because it does not accurately describe the issue at hand
REGRESSION. Last worked in version 6u45
ADDITIONAL REGRESSION INFORMATION:
1.8.0_05, 1.8.0_11 both produce this bug. Higher versions not tested, some lower versions tested and do not produce this.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
https://stackoverflow.com/revisions/25394998/1
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Something similar to the following error message is given:
non-static method methodName(Object...) cannot be referenced from a static context
ACTUAL -
Something similar to the following error message is given:
method methodName in class Clazz cannot be applied to given types;
required: Object[]
found: Object[]
reason: varargs mismatch; Object[] cannot be converted to Object
ERROR MESSAGES/STACK TRACES THAT OCCUR :
method methodName in class Clazz cannot be applied to given types;
required: Object[]
found: Object[]
reason: varargs mismatch; Object[] cannot be converted to Object
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class PrimitiveVarArgs
{
public static void main(String[] args)
{
int[] ints = new int[]{1, 2, 3, 4, 5};
prints(ints);
}
void prints(int... ints)
{
for(int i : ints)
System.out.println(i);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
add "static" to the non-static method and pretend the error never happened
- backported by
-
JDK-8058094 Wrong, confusing error when non-static varargs referenced in static context
-
- Resolved
-
-
JDK-8064052 Wrong, confusing error when non-static varargs referenced in static context
-
- Resolved
-
-
JDK-8070272 Wrong, confusing error when non-static varargs referenced in static context
-
- Resolved
-
-
JDK-8085395 Wrong, confusing error when non-static varargs referenced in static context
-
- Resolved
-
- duplicates
-
JDK-8065312 javac incorrectly reports cause of error on non-static varargs call from static
-
- Closed
-