Skip to content

Commit

Permalink
fix(openapi): java.lang packaged classes aren't added as imports
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa committed Oct 24, 2024
1 parent b6bcc3d commit 64a9e1f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ public interface ImportManager {

default void addImport(String importedClass) {
// Only add import if it belongs to a different package
if (!Objects.equals(importedClass.substring(0, importedClass.lastIndexOf('.')), getPackageName())) {
getImports().add(importedClass);
if (Objects.equals(importedClass.substring(0, importedClass.lastIndexOf('.')), getPackageName())) {
return;
}
// Do not import classes from java.lang
if (importedClass.substring(0, importedClass.lastIndexOf('.')).equals("java.lang")) {
return;
}
getImports().add(importedClass);
}

default void addAllImports(Collection<String> allImports) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

package io.fabric8.openshift.api.model.installer.baremetal.v1;

import java.lang.String;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

package io.fabric8.openshift.api.model.installer.v1;

import java.lang.String;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.annotation.Generated;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

package io.fabric8.openshift.api.model.installer.v1;

import java.lang.String;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.annotation.Generated;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

package io.fabric8.openshift.api.model.installer.v1;

import java.lang.String;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
Expand Down

0 comments on commit 64a9e1f

Please sign in to comment.