-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Description
Consider the following expression (constructor):
new ElegantObject(
"fibonacci",
new String[]{
"+package org.eolang.examples",
"+architect yegor256@gmail.com",
"",
"# This is the main abstract object that",
"# represents n-th Fibonacci number",
"[n] > fibonacci",
" if. > @",
" lt.",
" n",
" n",
" plus.",
" ^.fibonacci",
" n.minus 1",
" ^.fibonacci",
" n.minus 2",
}
)qulice complaints on it with the following error:
[INFO] PMD: src/test/java/integration/JarIT.java[98-126]: Unnecessary explicit array creation for varargs method call (UnnecessaryVarargsArrayCreation)because the ElegantObject has the following constructor:
private ElegantObject(final String file, final String... content) {
this.file = file;
this.content = String.join("\n", content);
}That said, we can't just remove new String[]:
new ElegantObject(
"fibonacci",
"+package org.eolang.examples",
"+architect yegor256@gmail.com",
"",
"# This is the main abstract object that",
"# represents n-th Fibonacci number",
"[n] > fibonacci",
" if. > @",
" lt.",
" n",
" 2",
" n",
" plus.",
" ^.fibonacci",
" n.minus 1",
" ^.fibonacci",
" n.minus 2"
)It's impossible, because we will get a compiler error as the following one:
The constructor JarIT.ElegantObject(String[]) is am
Expected behaviour:
qulice doesn't complain on methods where it's impossible to replace array creation with varags.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels