Issue 10. Support of default methods in interface has been added.

This commit is contained in:
Ilja Dubinin 2014-05-16 03:10:24 +04:00 committed by Ilja Dubinin
parent 0b1e5a3fdb
commit de52fa1d34
25 changed files with 181 additions and 641 deletions

View File

@ -18,12 +18,12 @@
////////////////////////////////////////////////////////////////////////////////
package com.puppycrawl.tools.checkstyle.api;
import com.google.common.collect.ImmutableMap;
import com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaTokenTypes;
import java.lang.reflect.Field;
import java.util.ResourceBundle;
import com.google.common.collect.ImmutableMap;
import com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaTokenTypes;
/**
* Contains the constants for all the tokens contained in the Abstract
* Syntax Tree.
@ -89,8 +89,10 @@ public final class TokenTypes
* @see #LITERAL_NATIVE
* @see #STRICTFP
* @see #ANNOTATION
* @see #LITERAL_DEFAULT
**/
public static final int MODIFIERS = GeneratedJavaTokenTypes.MODIFIERS;
/**
* An object block. These are children of class, interface, enum,
* annotation and enum constant declarations.
@ -1924,6 +1926,7 @@ public final class TokenTypes
* children.
*
* @see #CASE_GROUP
* @see #MODIFIERS
**/
public static final int LITERAL_DEFAULT =
GeneratedJavaTokenTypes.LITERAL_default;

View File

@ -411,11 +411,13 @@ modifiers
//hush warnings since the semantic check for "@interface" solves the non-determinism
options{generateAmbigWarnings=false;}:
modifier
modifier
|
//Semantic check that we aren't matching @interface as this is not an annotation
//A nicer way to do this would be, um, nice
{LA(1)==AT && !LT(2).getText().equals("interface")}? annotation
)*
{#modifiers = #([MODIFIERS, "MODIFIERS"], #modifiers);}
@ -435,6 +437,7 @@ modifier
// | "const" // reserved word, but not valid
| "volatile"
| "strictfp"
| "default"
;
annotation!
@ -744,61 +747,61 @@ implementsClause
// need to be some semantic checks to make sure we're doing the right thing...
field!
: // method, constructor, or variable declaration
mods:modifiers
( td:typeDefinitionInternal[#mods]
{#field = #td;}
mods:modifiers
(td:typeDefinitionInternal[#mods]
{#field = #td;}
// A generic method/ctor has the typeParameters before the return type.
// This is not allowed for variable definitions, but this production
// allows it, a semantic check could be used if you wanted.
| (tp:typeParameters)?
(
h:ctorHead s:constructorBody // constructor
{#field = #(#[CTOR_DEF,"CTOR_DEF"], mods, tp, h, s);}
// A generic method/ctor has the typeParameters before the return type.
// This is not allowed for variable definitions, but this production
// allows it, a semantic check could be used if you wanted.
| (tp:typeParameters)?
(
h:ctorHead s:constructorBody // constructor
{#field = #(#[CTOR_DEF,"CTOR_DEF"], mods, tp, h, s);}
|
t:typeSpec[false] // method or variable declaration(s)
( IDENT // the name of the method
|
t:typeSpec[false] // method or variable declaration(s)
( IDENT // the name of the method
// parse the formal parameter declarations.
LPAREN param:parameterDeclarationList RPAREN
// parse the formal parameter declarations.
LPAREN param:parameterDeclarationList RPAREN
rt:declaratorBrackets[#t]
rt:declaratorBrackets[#t]
// get the list of exceptions that this method is
// declared to throw
(tc:throwsClause)?
// get the list of exceptions that this method is
// declared to throw
(tc:throwsClause)?
( s2:compoundStatement | s5:SEMI )
{#field = #(#[METHOD_DEF,"METHOD_DEF"],
mods,
tp,
#(#[TYPE,"TYPE"],rt),
IDENT,
LPAREN,
param,
RPAREN,
tc,
s2,
s5);}
| v:variableDefinitions[#mods,#t] s6:SEMI
{
#field = #v;
#v.addChild(#s6);
}
( s2:compoundStatement | s5:SEMI )
{#field = #(#[METHOD_DEF,"METHOD_DEF"],
mods,
tp,
#(#[TYPE,"TYPE"],rt),
IDENT,
LPAREN,
param,
RPAREN,
tc,
s2,
s5);}
| v:variableDefinitions[#mods,#t] s6:SEMI
{
#field = #v;
#v.addChild(#s6);
}
)
)
)
)
)
// "static { ... }" class initializer
| si:"static" s3:compoundStatement
{#si.setType(STATIC_INIT);
#si.setText("STATIC_INIT");
#field = #(#si, s3);}
// "static { ... }" class initializer
| si:"static" s3:compoundStatement
{#si.setType(STATIC_INIT);
#si.setText("STATIC_INIT");
#field = #(#si, s3);}
// "{ ... }" instance initializer
| s4:compoundStatement
{#field = #(#[INSTANCE_INIT,"INSTANCE_INIT"], s4);}
// "{ ... }" instance initializer
| s4:compoundStatement
{#field = #(#[INSTANCE_INIT,"INSTANCE_INIT"], s4);}
;
constructorBody
@ -975,7 +978,7 @@ compoundStatement
// overrides the statement production in java.g, adds assertStatement
statement
: traditionalStatement
| assertStatement
| assertStatement
;
// assert statement, available since JDK 1.4
@ -988,70 +991,70 @@ traditionalStatement
// A list of statements in curly braces -- start a new scope!
: compoundStatement
// declarations are ambiguous with "ID DOT" relative to expression
// statements. Must backtrack to be sure. Could use a semantic
// predicate to test symbol table to see what the type was coming
// up, but that's pretty hard without a symbol table ;)
| (declaration)=> declaration SEMI
// declarations are ambiguous with "ID DOT" relative to expression
// statements. Must backtrack to be sure. Could use a semantic
// predicate to test symbol table to see what the type was coming
// up, but that's pretty hard without a symbol table ;)
| (declaration)=> declaration SEMI
// An expression statement. This could be a method call,
// assignment statement, or any other expression evaluated for
// side-effects.
| expression SEMI
// An expression statement. This could be a method call,
// assignment statement, or any other expression evaluated for
// side-effects.
| expression SEMI
// class definition
| m:modifiers! classDefinition[#m]
// class definition
| m:modifiers! classDefinition[#m]
// Attach a label to the front of a statement
| IDENT c:COLON^ {#c.setType(LABELED_STAT);} statement
// Attach a label to the front of a statement
| IDENT c:COLON^ {#c.setType(LABELED_STAT);} statement
// If-else statement
| "if"^ LPAREN expression RPAREN statement
(
// CONFLICT: the old "dangling-else" problem...
// ANTLR generates proper code matching
// as soon as possible. Hush warning.
options {
warnWhenFollowAmbig = false;
}
:
elseStatement
// If-else statement
| "if"^ LPAREN expression RPAREN statement
(
// CONFLICT: the old "dangling-else" problem...
// ANTLR generates proper code matching
// as soon as possible. Hush warning.
options {
warnWhenFollowAmbig = false;
}
:
elseStatement
)?
// For statement
| forStatement
// For statement
| forStatement
// While statement
| "while"^ LPAREN expression RPAREN statement
// While statement
| "while"^ LPAREN expression RPAREN statement
// do-while statement
| "do"^ statement w:"while" {#w.setType(DO_WHILE);} LPAREN expression RPAREN SEMI
// do-while statement
| "do"^ statement w:"while" {#w.setType(DO_WHILE);} LPAREN expression RPAREN SEMI
// get out of a loop (or switch)
| "break"^ (IDENT)? SEMI
// get out of a loop (or switch)
| "break"^ (IDENT)? SEMI
// do next iteration of a loop
| "continue"^ (IDENT)? SEMI
// do next iteration of a loop
| "continue"^ (IDENT)? SEMI
// Return an expression
| "return"^ (expression)? SEMI
// Return an expression
| "return"^ (expression)? SEMI
// switch/case statement
| "switch"^ LPAREN expression RPAREN LCURLY
( casesGroup )*
RCURLY
// switch/case statement
| "switch"^ LPAREN expression RPAREN LCURLY
( casesGroup )*
RCURLY
// exception try-catch block
| tryBlock
// exception try-catch block
| tryBlock
// throw an exception
| "throw"^ expression SEMI
// throw an exception
| "throw"^ expression SEMI
// synchronize a statement
| "synchronized"^ LPAREN expression RPAREN compoundStatement
// synchronize a statement
| "synchronized"^ LPAREN expression RPAREN compoundStatement
// empty statement
| s:SEMI {#s.setType(EMPTY_STAT);}
// empty statement
| s:SEMI {#s.setType(EMPTY_STAT);}
;
forStatement
@ -1106,7 +1109,17 @@ aCase
;
caseSList
: (statement)*
:
(
//Here was nondeterministic warnig between default block into switch and default modifier
//on methods (Java8). But we have semantic check for this.
options {
warnWhenFollowAmbig = false;
}
:
{LA(1)!=LITERAL_default}?
statement
)*
{#caseSList = #(#[SLIST,"SLIST"],#caseSList);}
;

View File

@ -1,32 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
public class AnnotationsTest extends BaseCheckTestSupport {
@Test
public void testInlineAnnotation()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputAnnotationsTest1.java"), expected);
}
@Test
public void testRepeatebleAnnotation()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputAnnotationsTest2.java"), expected);
}
}

View File

@ -1,3 +1,21 @@
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2014 Oliver Burn
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////
package com.puppycrawl.tools.checkstyle.grammars.java8;
import org.junit.Test;
@ -6,17 +24,33 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
public class DefaulMethodsTest extends BaseCheckTestSupport {
public class DefaulMethodsTest extends BaseCheckTestSupport
{
@Test
public void testCanParse()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputDefaultMethodsTest.java"), expected);
@Test
public void testCanParse()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig,
getPath("grammars/java8/InputDefaultMethodsTest.java"),
expected);
}
}
@Test
public void testSwitch()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig,
getPath("grammars/java8/InputDefaultMethodsTest2.java"),
expected);
}
}

View File

@ -1,165 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
public class LambdaTest extends BaseCheckTestSupport {
@Test
public void testLambdaInVariableInitialization()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputLambdaTest1.java"), expected);
}
@Test
public void testWithoutArgsOneLineLambdaBody()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputLambdaTest2.java"), expected);
}
@Test
public void testWithoutArgsFullLambdaBody()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputLambdaTest3.java"), expected);
}
@Test
public void testWithOneArgWithOneLineBody()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputLambdaTest4.java"), expected);
}
@Test
public void testWithOneArgWithFullBody()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputLambdaTest5.java"), expected);
}
@Test
public void testWithOneArgWIthoutTypeOneLineBody()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputLambdaTest6.java"), expected);
}
@Test
public void testWithOneArgWIthoutTypeFullBody()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputLambdaTest7.java"), expected);
}
@Test
public void testWithFewArgsWithoutTypeOneLineBody()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputLambdaTest8.java"), expected);
}
@Test
public void testWithFewArgsWithoutTypeFullBody()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputLambdaTest9.java"), expected);
}
@Test
public void testWithOneArgWIthoutParenthesesWithoutTypeOneLineBody()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputLambdaTest10.java"), expected);
}
@Test
public void testWithOneArgWIthoutParenthesesWithoutTypeFullBody()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputLambdaTest11.java"), expected);
}
@Test
public void testWithFewArgWIthTypeOneLine()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputLambdaTest12.java"), expected);
}
@Test
public void testWithFewArgWithTypeFullBody()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputLambdaTest13.java"), expected);
}
@Test
public void testWIthMultilineBody()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputLambdaTest14.java"), expected);
}
}

View File

@ -1,21 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
public class MethodReferencesTest extends BaseCheckTestSupport {
@Test
public void testCanParse()
throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
verify(checkConfig, getPath("grammars/java8/InputMethodReferencesTest.java"), expected);
}
}

View File

@ -1,38 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
import java.util.Arrays;
import java.util.List;
public class InputTypeAnnotationsTest1 {
@NonNull
List<Integer> numbers;
public static void main(String[] args) {
Object str = "";
String myString = (@NonNull String) str;
Object object = new @Interned Object();
}
void monitorTemperature() throws @Critical Exception { }
abstract class UnmodifiableList<T> implements @Readonly List<@Readonly T> {
}
@interface NonNull {
}
@interface Readonly {
}
@interface Interned {
}
@interface Critical {
}
}

View File

@ -1,13 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
import java.util.Arrays;
import java.util.List;
@Schedule
public class InputTypeAnnotationsTest2 {
@Repeatable(Schedules.class)
public @interface Schedule {
Schedule[] value;
}
}

View File

@ -1,11 +1,11 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
public interface InputDefaultMethods {
public interface InputDefaultMethodsTest {
default public void doSomething(){
System.out.println("Something done.");
}
public void doOneMoreThing();
}

View File

@ -0,0 +1,19 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
public class InputDefaultMethodsTest2 {
public void doSomething(){
switch (a)
{
case 0:
break;
default:
break;
}
}
}

View File

@ -1,12 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
public class InputLabdaTest1 {
static Runnable r1 = ()->System.out.println("Hello world one!");
static Runnable r2 = () -> System.out.println("Hello world two!");
public static void main(String[] args) {
r1.run();
r2.run();
}
}

View File

@ -1,20 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
public class InputLabdaTest10 {
public static void testVoidLambda(TestOfVoidLambdas test) {
System.out.println("Method called");
test.doSmth("fef");
}
public static void main(String[] args) {
testVoidLambda(s1 -> System.out.println(s1));
}
private interface TestOfVoidLambdas {
public void doSmth(String first);
}
}

View File

@ -1,20 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
public class InputLabdaTest11 {
public static void testVoidLambda(TestOfVoidLambdas test) {
System.out.println("Method called");
test.doSmth("fef");
}
public static void main(String[] args) {
testVoidLambda(s1 -> {System.out.println(s1);});
}
private interface TestOfVoidLambdas {
public void doSmth(String first);
}
}

View File

@ -1,20 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
public class InputLabdaTest12 {
public static void testVoidLambda(TestOfVoidLambdas test) {
System.out.println("Method called");
test.doSmth("fef", 5);
}
public static void main(String[] args) {
testVoidLambda((String s1, Integer i2) -> System.out.println(s1));
}
private interface TestOfVoidLambdas {
public void doSmth(String first, Integer second);
}
}

View File

@ -1,22 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
public class InputLabdaTest12 {
public static void testVoidLambda(TestOfVoidLambdas test) {
System.out.println("Method called");
test.doSmth("fef", 5);
}
public static void main(String[] args) {
testVoidLambda((String s1, Integer i2) -> {
System.out.println(s1);
});
}
private interface TestOfVoidLambdas {
public void doSmth(String first, Integer second);
}
}

View File

@ -1,18 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
import java.util.Arrays;
import java.util.List;
public class InputLambdaTest14 {
public static void main(String args[]) {
List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5);
numbers.forEach(first -> {
System.out.println("first");
System.out.println("second");
System.out.println("third");
});
}
}

View File

@ -1,24 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
import java.util.Arrays;
import java.util.List;
import TestLabmda.TestOfVoidLambdas;
public class InputLabdaTest2 {
public static void testVoidLambda(TestOfVoidLambdas test) {
System.out.println("Method called");
test.doSmth();
}
public static void main(String[] args) {
testVoidLambda(() -> System.out.println("Method in interface called"));
}
private interface TestOfVoidLambdas {
public void doSmth();
}
}

View File

@ -1,26 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
import java.util.Arrays;
import java.util.List;
import TestLabmda.TestOfVoidLambdas;
public class InputLabdaTest3 {
public static void testVoidLambda(TestOfVoidLambdas test) {
System.out.println("Method called");
test.doSmth();
}
public static void main(String[] args) {
testVoidLambda(() -> {
System.out.println("Method in interface called");
});
}
private interface TestOfVoidLambdas {
public void doSmth();
}
}

View File

@ -1,10 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
public class InputLabdaTest4 {
public void doSomething() {
List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
numbers.forEach((Integer value) -> System.out.println(value));
}
}

View File

@ -1,10 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
public class InputLabdaTest5 {
public void doSomething() {
List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
numbers.forEach((Integer value) -> {System.out.println(value);});
}
}

View File

@ -1,10 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
public class InputLabdaTest6 {
public void doSomething() {
List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
numbers.forEach((value) -> System.out.println(value));
}
}

View File

@ -1,15 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
import java.util.Arrays;
import java.util.List;
public class InputLabdaTest7 {
public void doSomething() {
List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6);
numbers.forEach((value) -> {
System.out.println(value);
});
}
}

View File

@ -1,19 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
public class InputLabdaTest8 {
public static void testVoidLambda(TestOfVoidLambdas test) {
System.out.println("Method called");
test.doSmth("fef", 2);
}
public static void main(String[] args) {
testVoidLambda((s1, s2) -> System.out.println(s1 + s2));
}
private interface TestOfVoidLambdas {
public void doSmth(String first, Integer second);
}
}

View File

@ -1,19 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
public class InputLabdaTest9 {
public static void testVoidLambda(TestOfVoidLambdas test) {
System.out.println("Method called");
test.doSmth("fef", 2);
}
public static void main(String[] args) {
testVoidLambda((s1, s2) -> {System.out.println(s1 + s2);});
}
private interface TestOfVoidLambdas {
public void doSmth(String first, Integer second);
}
}

View File

@ -1,15 +0,0 @@
package com.puppycrawl.tools.checkstyle.grammars.java8;
import java.util.Arrays;
import java.util.List;
public interface InputDefaultMethods {
public static void main(String args[]) {
List<Integer> numbers = Arrays.asList(1,2,3,4,5,6);
numbers.forEach(System.out::println);
}
}