mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Java: Add test for Java 16 target when only Java 17+ is available
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>maven-java16-with-higher-jdk</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<name>maven-java16-with-higher-jdk</name>
|
||||
<description>Test case: Java 16 target when only Java 17+ is available.</description>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>16</java.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<release>${java.version}</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,3 @@
|
||||
pom.xml
|
||||
src/main/java/com/example/App.java
|
||||
target/maven-archiver/pom.properties
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.example;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Simple class using Java 16 features (e.g.,records).
|
||||
*/
|
||||
public class App {
|
||||
public static void main(String[] args) {
|
||||
Person person = new Person("Bob", 42);
|
||||
System.out.println(person);
|
||||
}
|
||||
}
|
||||
|
||||
record Person(String name, int age) {}
|
||||
@@ -0,0 +1,2 @@
|
||||
def test(codeql, java):
|
||||
codeql.database.create()
|
||||
Reference in New Issue
Block a user