It seems as though double-brace initialization increases overhead.
Does using braces inside of a method also reduce performance?
eg.
public class DoIReducePerformanceToo {
public void aMethod() {
{
// Is it a bad idea to use these?
}
}
}
I've taken a look at Java's grammar and it seems that this is classified as a block:
Block:
{ BlockStatements }
BlockStatements:
{ BlockStatement }
BlockStatement:
LocalVariableDeclarationStatement
ClassOrInterfaceDeclaration
[Identifier :] Statement
but I'm not sure where in the grammar double-brace initialization falls.
My question: does using block statements in methods reduce performance in Java? And are these blocks of the same nature as double-brace initialization?
EDIT:
Inner class instantation is:
ClassCreatorRest: Arguments [ClassBody]
ClassBody:
{ { ClassBodyDeclaration } }