Skip to content

Commit

Permalink
reformat javaconcept take 2
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyGan437 committed Oct 20, 2023
1 parent c3f4101 commit 2f5b010
Show file tree
Hide file tree
Showing 13 changed files with 1,035 additions and 794 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,16 @@ void printingExamplePrettyPrintVisitor() throws IOException {

@Test
void printingExampleJavaConcepts() throws IOException {
CompilationUnit cu = parse(rootDir.resolve("com/github/javaparser/printer/JavaConcepts.java"));
TestUtils.assertEqualsStringIgnoringEol(prettyPrintedExpectation("JavaConcepts"), prettyPrint(cu));
}
CompilationUnit base = parse(rootDir.resolve("com/github/javaparser/printer/JavaConceptsBase.java"));
CompilationUnit enums = parse(rootDir.resolve("com/github/javaparser/printer/JavaConceptsEnums.java"));
CompilationUnit innerClass = parse(rootDir.resolve("com/github/javaparser/printer/JavaConceptsInnerClasses.java"));
CompilationUnit methods = parse(rootDir.resolve("com/github/javaparser/printer/JavaConceptsMethods.java"));
CompilationUnit ugly = parse(rootDir.resolve("com/github/javaparser/printer/JavaConceptsUgly.java"));
TestUtils.assertEqualsStringIgnoringEol(prettyPrintedExpectation("JavaConceptsBase"), prettyPrint(base));
TestUtils.assertEqualsStringIgnoringEol(prettyPrintedExpectation("JavaConceptsEnums"), prettyPrint(enums));
TestUtils.assertEqualsStringIgnoringEol(prettyPrintedExpectation("JavaConceptsInnerClasses"), prettyPrint(innerClass));
TestUtils.assertEqualsStringIgnoringEol(prettyPrintedExpectation("JavaConceptsMethods"), prettyPrint(methods));
TestUtils.assertEqualsStringIgnoringEol(prettyPrintedExpectation("JavaConceptsUgly"), prettyPrint(ugly));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
*
* This file is part of JavaParser.
*
* JavaParser can be used either under the terms of
* a) the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* b) the terms of the Apache License
*
* You should have received a copy of both licenses in LICENCE.LGPL and
* LICENCE.APACHE. Please refer to those files for details.
*
* JavaParser 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.
*/
package japa.bdd.samples;

import com.github.javaparser.JavaParser;
import japa.parser.ParseException;
import com.github.javaparser.ast.CompilationUnit;
import java.io.*;
import java.util.*;

@Deprecated
public class JavaConceptsBase<T extends List<int[]>, X> extends Base implements Serializable {

static Class clz1 = String.class;

protected Class clz2 = (String.class);

Class clz3 = int.class;

Class clz4 = (int.class);

int[] arr = new int[10];

byte bye = 0;

byte[] byebye = null;

short sh1, sh2 = 1;

int intWithUnderscore = 1234_5678;

long longWithUnderscore = 1234_5678L;

float floatWithUnderscore = 1_234.5_678f;

float floatWithUnderscoreAndExponent = 1_234e1_0f;

double doubleWithUnderscore = 1_234.5_678;

double doubleWithUnderscoreAndExponent = 1_234e1_0;

int binaryLiteral = 0b101101;

List<String>[][] arrLS = (List<String>[][]) new List<?>[10][];

int[][][][] arr2 = new int[10][2][1][0];

volatile float fff = 0x1.fffeP+127f;

char cc = 'a';

int[][] arr3 = { { 1, 2 }, { 3, 4 } };

static int[][] arr4 = {};

static {
arr4 = new int[][] { { 2 }, { 1 } };
}

{
arr3 = new int[][] { { 2 }, { 1 } };
}

public static JavaConceptsBase t;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
*
* This file is part of JavaParser.
*
* JavaParser can be used either under the terms of
* a) the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* b) the terms of the Apache License
*
* You should have received a copy of both licenses in LICENCE.LGPL and
* LICENCE.APACHE. Please refer to those files for details.
*
* JavaParser 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.
*/
package japa.bdd.samples;

@Deprecated
public class JavaConceptsEnums {

public enum Teste {

asc,
def
}

public enum Sexo {

m,
@Deprecated
f;

public enum Sexo_ implements Serializable, Cloneable {

}
}

@Deprecated
public enum Enum {

m(1) {

@Override
void mm() {
}
}
,
f(2) {

void mm() {
}
}
;

native void nnn();

transient int x;

private Enum(int x) {
this.x = x;
}

abstract void mm();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/*
* Copyright (C) 2007-2010 Júlio Vilmar Gesser.
* Copyright (C) 2011, 2013-2016 The JavaParser Team.
*
* This file is part of JavaParser.
*
* JavaParser can be used either under the terms of
* a) the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* b) the terms of the Apache License
*
* You should have received a copy of both licenses in LICENCE.LGPL and
* LICENCE.APACHE. Please refer to those files for details.
*
* JavaParser 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.
*/
package japa.bdd.samples;

import com.github.javaparser.JavaParser;
import japa.parser.ParseException;
import com.github.javaparser.ast.CompilationUnit;
import org.junit.Ignore;
import java.io.*;
import java.util.*;

@Ignore
@Deprecated
public class JavaConceptsInnerClasses<T extends List<int[]>, X> extends Base implements Serializable {

public <T, E> JavaConceptsInnerClasses(int x) {
this.arr[0] = x;
T val1 = null;
E val2 = null;
super.<T, E>check2(val1, val2);
boolean b = true, y = false;
abstract class X {

int i = 0;

public <D> X() {
}

public void m() {
}
}
@Deprecated
final class Y extends X {

public Y() {
super();
JavaConceptsInnerClasses.this.cc = 'c';
super.i = 1;
Y.super.m();
}

public Y(int y) {
super();
}

public Y(long x) {
this();
}
}
}

public <T> JavaConceptsInnerClasses(String str) {
}

private class QWE extends JavaConceptsInnerClasses<List<int[]>, String> {

@Deprecated
final int z = 0;

int i = (int) -1;

public QWE(String... x) {
<String>super(x[0]);
}

public QWE(int... x) {
super(x[0]);
i = x[0];
assert true;
assert 1 == 1 : 2;
{
int iii = 3;
iii += 3;
}
label: {
int iii = 1;
}
;
;
int min = -2147483648;
long sl = 123123123123l;
long minl = -9223372036854775808L;
switch(i) {
}
ll: switch(i) {
case 1:
System.out.println(1);
break ll;
default:
{
System.out.println("default");
break;
}
case 2:
if (t instanceof Base) {
System.out.println(1);
}
i++;
++i;
}
}

private synchronized int[] doSomething() {
List<? extends Number> x = new ArrayList<Integer>();
return new int[] { 1 };
}
}
}

class Base {

public <A, B> void check2(A val1, B val2) {
}
}

interface XXX extends Serializable, Cloneable {
}
Loading

0 comments on commit 2f5b010

Please sign in to comment.