aboutsummaryrefslogtreecommitdiff
path: root/javaparser-symbol-solver-testing/src/test/test_sourcecode/javaparser_new_src/javaparser-core/com/github/javaparser/ast/Example.java
blob: 70cf2cd91bed34b11901c65ff19dcc52ee67e2cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.github.javaparser.ast;

import com.github.javaparser.JavaParser;
import com.github.javaparser.ParseException;
import com.github.javaparser.ast.CompilationUnit;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;

/**
 * Created by federico on 07/01/16.
 */
public class Example {

    public static void main(String[] args) throws UnsupportedEncodingException, ParseException {
        String code = "interface A {\n" +
                "    default Comparator<T> thenComparing(Comparator<? super T> other) {\n" +
                "        Objects.requireNonNull(other);\n" +
                "        return (Comparator<T> & Serializable) (c1, c2) -> { // this is the defaulting line\n" +
                "            int res = compare(c1, c2);\n" +
                "            return (res != 0) ? res : other.compare(c1, c2);\n" +
                "        };\n" +
                "    }\n" +
                "}";
        InputStream stream = new ByteArrayInputStream(code.getBytes("UTF-8"));
        CompilationUnit cu = JavaParser.parse(stream);

    }

}