Skip to content

Commit f8686a4

Browse files
committed
Add substitution for Apache POI class with hard log4j reference
1 parent 48a4720 commit f8686a4

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
3+
*
4+
* See the AUTHORS file(s) distributed with this work for additional
5+
* information regarding authorship.
6+
*
7+
* This Source Code Form is subject to the terms of the Mozilla Public
8+
* License, v. 2.0. If a copy of the MPL was not distributed with this
9+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
10+
*
11+
* SPDX-License-Identifier: MPL-2.0
12+
*/
13+
14+
package org.eclipse.esmf.substitution;
15+
16+
import com.oracle.svm.core.annotate.Alias;
17+
import com.oracle.svm.core.annotate.RecomputeFieldValue;
18+
import com.oracle.svm.core.annotate.TargetClass;
19+
import org.apache.logging.log4j.Logger;
20+
import org.apache.poi.openxml4j.opc.OPCPackage;
21+
22+
/**
23+
* This is a <a href="https://build-native-java-apps.cc/developer-guide/substitution/">GraalVM substitution class</a>
24+
* for {@link OPCPackage}.
25+
* Reason: The hard reference to a Log4J logger is not resolveable/instantiatable at runtime, so it is replaced with
26+
* a dummy logger.
27+
*/
28+
@TargetClass( OPCPackage.class )
29+
@SuppressWarnings( {
30+
"unused",
31+
"squid:S00101", // Class name uses GraalVM substitution class naming schema, see
32+
// https://github.com/oracle/graal/tree/master/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk
33+
"checkstyle:TypeName",
34+
"NewClassNamingConvention" } )
35+
public final class Target_org_apache_poi_openxml4j_opc_OPCPackage {
36+
@SuppressWarnings( { "NonConstantLogger", "NonConstantFieldWithUpperCaseName" } )
37+
@Alias
38+
@RecomputeFieldValue( kind = RecomputeFieldValue.Kind.FromAlias )
39+
private static Logger LOG = new DummyLogger();
40+
}

0 commit comments

Comments
 (0)