Skip to content

Commit

Permalink
Java16 (#70)
Browse files Browse the repository at this point in the history
* Java16
  • Loading branch information
jolarsen authored May 12, 2021
1 parent 4df8399 commit 6ad3213
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 11
java-version: 16
- name: Hent tag
run: echo "TAG=$(git log -1 --pretty='%ad' --date=format:'%Y%m%d%H%M%S')-$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 11
java-version: 16
- name: Hent tag
run: echo "TAG=$(git log -1 --pretty='%ad' --date=format:'%Y%m%d%H%M%S')-$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '16'
distribution: 'adopt'

- name: Setup build cache
Expand Down
2 changes: 1 addition & 1 deletion .java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11.0
16
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<revision>1.0-SNAPSHOT</revision>
<java.version>11</java.version>
<java.version>16</java.version>
<jupiter.version>5.7.1</jupiter.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
Expand Down Expand Up @@ -124,7 +124,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.6</version>
<version>0.8.7</version>
<executions>
<execution>
<id>report</id>
Expand Down Expand Up @@ -155,7 +155,7 @@
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.8.0.2131</version>
<version>3.9.0.2155</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
10 changes: 2 additions & 8 deletions src/main/java/no/nav/fpsak/nare/doc/RuleEdge.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@
import com.fasterxml.jackson.annotation.JsonInclude.Include;

@JsonInclude(Include.NON_NULL)
public class RuleEdge {
String source;
String target;
String role;

public record RuleEdge(String source, String target, String role) {
public RuleEdge(RuleNode source, RuleNode target, String edgeRole) {
this.source = source.id;
this.target = target.id;
role = edgeRole;
this(source.id, target.id, edgeRole);
}
}
11 changes: 1 addition & 10 deletions src/main/java/no/nav/fpsak/nare/doc/doclet/GrunnlagModell.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,7 @@ class GrunnlagModell implements MarkupOutput {
private final List<Entry> entries = new ArrayList<>();
private DocletEnvironment docEnv;

static class Entry {
TypeElement targetClass;
String name;
String classDoc;

Entry(TypeElement targetClass, String name, String classDoc) {
this.targetClass = targetClass;
this.name = name;
this.classDoc = classDoc;
}
static record Entry(TypeElement targetClass, String name, String classDoc) {
}

public GrunnlagModell(DocletEnvironment docEnv) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/no/nav/fpsak/nare/doc/doclet/RegelModell.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static class Entry {
private static Optional<String> getRuleServiceITypeName(Type[] interfaces) {
Optional<String> getGenericInterfaceTypeName = Optional.empty();
Optional<Type> ruleServiceType = Arrays.stream(interfaces)
.filter(interfaze -> isRuleService(interfaze))
.filter(RegelModell::isRuleService)
.findFirst();

if (ruleServiceType.isPresent()) {
Expand Down Expand Up @@ -96,7 +96,7 @@ private Optional<String> getGenericType(Entry entry) {
Type[] interfaces = entry.targetClass.getGenericInterfaces();
Optional<String> genericTypeName = getRuleServiceITypeName(interfaces);

if (!genericTypeName.isPresent()) {
if (genericTypeName.isEmpty()) {
Class<?> c = entry.targetClass.getSuperclass();
Type[] superclassGenericTypes = c.getGenericInterfaces();
if (superclassGenericTypes == null || superclassGenericTypes.length == 0) {
Expand Down
14 changes: 3 additions & 11 deletions src/main/java/no/nav/fpsak/nare/doc/doclet/RegelflytModell.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,9 @@ class RegelflytModell implements MarkupOutput {

private final List<Entry> entries = new ArrayList<>();

static class Entry {
String name;
String simpleName;

private Entry(String qualifiedName) {
this.name = qualifiedName;
this.simpleName = simplifyName(qualifiedName);
}

private String simplifyName(String name) {
return name.replaceAll("\\.", "_").toLowerCase();
static record Entry(String name, String simpleName) {
Entry(String name) {
this(name, name.replaceAll("\\.", "_").toLowerCase());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public boolean run(DocletEnvironment docEnv) {
RegelflytDoc regelflytDoc = new RegelflytDoc(docEnv, regelModell, getOutputLocation());
try {
Set<TypeElement> types = ElementFilter.typesIn(docEnv.getIncludedElements());
types.stream().forEach(t -> regelflytDoc.process(t));
types.stream().forEach(regelflytDoc::process);
File outputFileAdoc = new File(getOutputLocation(), "regler");
new AsciidocMapper().writeTo(outputFileAdoc.toPath(), regelModell);
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public EvaluationRuleDescription(Operator operator, Evaluation evaluation,
List<? extends Evaluation> children) {
super(operator, evaluation.ruleIdentification(), evaluation.ruleDescriptionText(),
children == null ? Collections.emptyList()
: children.stream().map(c -> c.toRuleDescription()).collect(Collectors.toList()));
: children.stream().map(Evaluation::toRuleDescription).collect(Collectors.toList()));
this.resultat = evaluation.result();
this.reason = evaluation.reason();
this.evaluationProperties = evaluation.getEvaluationProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ public class DummyRegelService implements RuleService<DummyRegelInput> {
@SuppressWarnings("unchecked")
@Override
public Specification<DummyRegelInput> getSpecification() {
return new LeafSpecification<DummyRegelInput>("hello.spec") {
return new LeafSpecification<>("hello.spec") {

@Override
public Evaluation evaluate(DummyRegelInput t) {
throw new UnsupportedOperationException("not implemented");
throw new UnsupportedOperationException("not implemented");
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public String beskrivelse() {
public Evaluation evaluate(Soknad soknad) {

Optional<Person> søker = soknad.getSøker(rolle);
if (!søker.isPresent()) {
if (søker.isEmpty()) {
return nei(ModrekvoteUtfall.ROLLE_INGEN_SØKER_MED_ROLLE, rolle);
} else if (!søker.get().harRettTilForeldrepenger()) {
return nei(ModrekvoteUtfall.ROLLE_HAR_IKKE_RETT, rolle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ private HarUttaksplanForModreKvote(String id, Soknadstype soknadstype, Uttakspla
@Override
public Evaluation evaluate(Soknad soknad) {
Optional<Person> soker = soknad.getSøker(MOR);
if (!soker.isPresent()) {
if (soker.isEmpty()) {
return nei(ModrekvoteUtfall.ROLLE_INGEN_SØKER_MED_ROLLE, MOR);
}

if (!soker.get().getUttaksplan().isPresent()) {
if (soker.get().getUttaksplan().isEmpty()) {
return nei(ModrekvoteUtfall.UTTAKSPLAN_MANGLER, MOR);
}

Expand Down

0 comments on commit 6ad3213

Please sign in to comment.