forked from apache/incubator-kie-drools
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JBRULES-3480] notify RF deprecation with a KnowledgeBuilder warning
- Loading branch information
1 parent
314325f
commit be22d5e
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
drools-compiler/src/main/java/org/drools/compiler/DeprecatedResourceTypeWarning.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.drools.compiler; | ||
|
||
import org.drools.io.Resource; | ||
import org.drools.io.internal.InternalResource; | ||
|
||
public class DeprecatedResourceTypeWarning extends DroolsWarning { | ||
|
||
private final String deprecatedFormat; | ||
|
||
public DeprecatedResourceTypeWarning(Resource resource) { | ||
this(resource, ((InternalResource) resource).getResourceType().getName()); | ||
} | ||
|
||
public DeprecatedResourceTypeWarning(Resource resource, String deprecatedFormat) { | ||
super(resource); | ||
this.deprecatedFormat = deprecatedFormat; | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return deprecatedFormat + " format usage detected. This format is deprecated and will be removed in future"; | ||
} | ||
|
||
@Override | ||
public int[] getLines() { | ||
return new int[0]; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
drools-compiler/src/main/java/org/drools/compiler/DroolsWarning.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.drools.compiler; | ||
|
||
import org.drools.builder.ResultSeverity; | ||
import org.drools.io.Resource; | ||
|
||
public abstract class DroolsWarning extends BaseKnowledgeBuilderResultImpl { | ||
|
||
public DroolsWarning(Resource resource) { | ||
super(resource); | ||
} | ||
|
||
@Override | ||
public ResultSeverity getSeverity() { | ||
return ResultSeverity.WARNING; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters