Skip to content
Merged
61 changes: 61 additions & 0 deletions .claude/skills/coding-conventions/java-coding-conventions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
name: java-coding-conventions
description: House style for writing and reviewing Java and XML code in this repository. Use this skill whenever you are writing new Java code, editing existing Java files, generating code samples in Java, reviewing or refactoring Java code, or touching XML files (pom.xml, etc.) in this repo. Enforces brace style, indentation, and Javadoc conventions specific to this codebase — apply automatically, don't wait for the user to ask about "style" or "conventions" explicitly.
---

# Java Coding Conventions

House style for this repository. Apply these rules by default to every Java and XML file you write or edit here, without being asked each time.

## Java rules

### Indentation
- **4 spaces per indent level.** No tabs, anywhere, ever.
- Continuation lines (wrapped method args, chained calls, long expressions) indent by an extra 8 spaces (two levels) from the start of the statement, to visually distinguish them from a new block.

### Braces — K&R "Egyptian brackets"
- The opening brace `{` stays on the **same line** as the declaration/statement, preceded by a single space.
- The closing brace `}` starts a new line, aligned with the start of the opening statement.
- `else`, `catch`, `finally` go on the **same line** as the preceding closing brace.
- Braces are **not required** for single-line, single statement ones.
- Braces are **required** for multi-line code blocks.

```java
public class OrderService {

public int computeTotal(List<Item> items) {
int total = 0;
for (Item item : items) {
if (item.isTaxable()) {
total += item.getPriceWithTax();
} else {
total += item.getPrice();
}
}
return total;
}

public void process() {
try {
doWork();
} catch (IOException e) {
log.error("Failed to process", e);
} finally {
cleanup();
}
}
}
```

### Javadoc / comments
- **No `@author` tags**, in any file, ever — not on new files, not when editing old ones. If you encounter an existing `@author` tag while editing a file for another reason, leave it unless the user asks you to clean it up (don't do drive-by removals that bloat an unrelated diff).
- Javadoc is otherwise written normally: `/** ... */` blocks above public classes/methods, `@param`, `@return`, `@throws` as appropriate.

### Other conventions (standard "common Java style" — flag deviations if you see them)
- One top-level public class per file, filename matches the class name.
- `UpperCamelCase` for classes/interfaces/enums, `lowerCamelCase` for methods/fields/variables, `UPPER_SNAKE_CASE` for constants.
- Opening brace of a class/method body counts as level 0; the first statement inside is indented one level (4 spaces) from the class/method declaration.
- Import order: standard groups (java.*, javax.*, third-party, then project packages), alphabetized within each group, with a blank line between groups.
- Imports: Use wildcard imports for packages with 5 or more class imports.
- Imports: Use wildcard static imports for 5 or more imports.
- Line length: wrap around 80–100 columns rather than let lines run on indefinitely
64 changes: 64 additions & 0 deletions .claude/skills/coding-conventions/source-code-conventions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
name: source-code-conventions
description: House style for writing and reviewing XML code in this repository.
---

## Source Code Conventions

- Java must have a license header at the top of the file, followed by one blank line

```java
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
```

- XML file must have a license header starting at the second line of the file
and followed by one blank line

```xml
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.

SPDX-License-Identifier: Apache-2.0
-->
```

- Shell Bash scripts should have a license header after the `#!` line and
followed by a blank line.

```
## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
```
13 changes: 13 additions & 0 deletions .claude/skills/coding-conventions/xml-formatting-conventions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: xml-formatting-conventions
description: House style for writing and reviewing XML code in this repository.
---

## XML Formatting Conventions

- **2 spaces per indent level.** No tabs.
- One attribute per line only when a tag has many attributes and would otherwise run long; short tags keep attributes inline.
- Self-closing tags (`<element .../>`) for elements with no children/content.
- Closing tags aligned with the indentation level of their opening tag.

(Note: keep XML indentation at 2 spaces even though Java in the same repo uses 4 — they're intentionally different.)
3 changes: 2 additions & 1 deletion jena-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<scope>test</scope>
</dependency>

<!-- Only for TS3_rdfxml_arp -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
Expand Down Expand Up @@ -149,7 +150,7 @@
<argLine>-XX:+EnableDynamicAgentLoading -Xshare:off</argLine>
<includes>
<include>org/apache/jena/test/JenaCoreTestAll_JU6.java</include>
<include>org/apache/jena/test/JenaCoreTestAll_JU4.java</include>
<include>org/apache/jena/test/JenaCoreTestAll_JU3.java</include>
</includes>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

package org.apache.jena.assembler;

import static org.junit.jupiter.api.Assertions.*;

import org.apache.jena.assembler.assemblers.AssemblerBase;
import org.apache.jena.assembler.exceptions.CannotConstructException;
import org.apache.jena.rdf.model.Model;
Expand All @@ -29,7 +31,6 @@
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.shared.BrokenException;
import org.apache.jena.shared.PrefixMapping;
import org.apache.jena.test.JenaTestBase;
import org.apache.jena.vocabulary.LocationMappingVocab;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;
Expand All @@ -40,7 +41,7 @@
* in subclasses to control the parser that is used to construct models and the
* prefixes added to the model (these features added for Eyeball).
*/
public class AssemblerTestBase extends JenaTestBase {
public class AssemblerTestBase {

protected Class<? extends Assembler> getAssemblerClass() {
throw new BrokenException("this class must define getAssemblerClass");
Expand Down Expand Up @@ -89,10 +90,6 @@ public Object open(Assembler a, Resource root, Mode irrelevant) {

protected static final Model schema = JA.getSchema();

public AssemblerTestBase(String name) {
super(name);
}

protected Model model(String string) {
Model result = ModelTestLib.createModel();
setRequiredPrefixes(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.apache.jena.rdf.model.*;
import org.apache.jena.rdf.model.impl.ModelCom;

import org.junit.Assert;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* A model assembler that creates a model with controllable supporting of
Expand All @@ -55,7 +55,7 @@ protected Model openEmptyModel(Assembler a, Resource root, Mode irrelevant) {
@Override
public Model begin() {
history.add("begin");
Assert.assertTrue(isEmpty());
assertTrue(isEmpty());
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,42 @@

package org.apache.jena.assembler;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.platform.suite.api.BeforeSuite;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.platform.suite.api.Suite;

@RunWith(Suite.class)
@Suite.SuiteClasses( {
// Convert to JUnit5
TestMode.class,
import org.apache.jena.test.JenaTestLib;

// JUnit3
@Suite
@SelectClasses({
TestMode.class,
TestModelExpansion.class,
TestImportManager.class,
TestOntModelAcceptance.class,

// // Was "TestAssemblers" : 19
TestRuleSet.class ,
TestAssemblerHelp.class ,
TestDefaultModelAssembler.class ,
TestMemoryModelAssembler.class ,
TestAssemblerVocabulary.class ,
TestRuleSetAssembler.class ,
TestInfModelAssembler.class ,
TestAssemblerGroup.class ,
TestAssemblerGroupTracing.class ,
TestReasonerFactoryAssembler.class ,
TestContentAssembler.class ,
TestModelContent.class ,
TestUnionModelAssembler.class ,
TestPrefixMappingAssembler.class ,
TestBuiltinAssemblerGroup.class ,
TestModelAssembler.class ,
TestDocumentManagerAssembler.class,
TestOntModelSpecAssembler.class,
TestOntModelAssembler.class
TestRuleSet.class,
TestAssemblerHelp.class,
TestDefaultModelAssembler.class,
TestMemoryModelAssembler.class,
TestAssemblerVocabulary.class,
TestRuleSetAssembler.class,
TestInfModelAssembler.class,
TestAssemblerGroup.class,
TestAssemblerGroupTracing.class,
TestReasonerFactoryAssembler.class,
TestContentAssembler.class,
TestModelContent.class,
TestUnionModelAssembler.class,
TestPrefixMappingAssembler.class,
TestBuiltinAssemblerGroup.class,
TestModelAssembler.class,
TestDocumentManagerAssembler.class,
TestOntModelSpecAssembler.class,
TestOntModelAssembler.class
})

public class TS3_Assembler {}
public class TS6_Assembler {
@BeforeSuite
public static void beforeSuite() {
JenaTestLib.setup();
}
}
Loading
Loading