Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additional units for unit checker; fixes #4116
- Loading branch information
Showing
18 changed files
with
602 additions
and
4 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
checker-qual/src/main/java/org/checkerframework/checker/units/qual/Force.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,19 @@ | ||
package org.checkerframework.checker.units.qual; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import org.checkerframework.framework.qual.SubtypeOf; | ||
|
||
/** | ||
* Units of force. | ||
* | ||
* @checker_framework.manual #units-checker Units Checker | ||
*/ | ||
@Documented | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
@SubtypeOf(UnknownUnits.class) | ||
public @interface Force {} |
22 changes: 22 additions & 0 deletions
22
checker-qual/src/main/java/org/checkerframework/checker/units/qual/N.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,22 @@ | ||
package org.checkerframework.checker.units.qual; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import org.checkerframework.framework.qual.SubtypeOf; | ||
|
||
/** | ||
* Newton. | ||
* | ||
* @checker_framework.manual #units-checker Units Checker | ||
*/ | ||
@Documented | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
@SubtypeOf(Force.class) | ||
@SuppressWarnings("checkstyle:typename") | ||
public @interface N { | ||
Prefix value() default Prefix.one; | ||
} |
19 changes: 19 additions & 0 deletions
19
checker-qual/src/main/java/org/checkerframework/checker/units/qual/Volume.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,19 @@ | ||
package org.checkerframework.checker.units.qual; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import org.checkerframework.framework.qual.SubtypeOf; | ||
|
||
/** | ||
* Units of volume. | ||
* | ||
* @checker_framework.manual #units-checker Units Checker | ||
*/ | ||
@Documented | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
@SubtypeOf(UnknownUnits.class) | ||
public @interface Volume {} |
21 changes: 21 additions & 0 deletions
21
checker-qual/src/main/java/org/checkerframework/checker/units/qual/kN.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,21 @@ | ||
package org.checkerframework.checker.units.qual; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import org.checkerframework.framework.qual.SubtypeOf; | ||
|
||
/** | ||
* Kilonewton. | ||
* | ||
* @checker_framework.manual #units-checker Units Checker | ||
*/ | ||
@Documented | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
@SubtypeOf(Force.class) | ||
@UnitsMultiple(quantity = N.class, prefix = Prefix.kilo) | ||
@SuppressWarnings("checkstyle:typename") | ||
public @interface kN {} |
20 changes: 20 additions & 0 deletions
20
checker-qual/src/main/java/org/checkerframework/checker/units/qual/km3.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,20 @@ | ||
package org.checkerframework.checker.units.qual; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import org.checkerframework.framework.qual.SubtypeOf; | ||
|
||
/** | ||
* Cubic kilometer. | ||
* | ||
* @checker_framework.manual #units-checker Units Checker | ||
*/ | ||
@Documented | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
@SubtypeOf(Volume.class) | ||
@SuppressWarnings("checkstyle:typename") | ||
public @interface km3 {} |
20 changes: 20 additions & 0 deletions
20
checker-qual/src/main/java/org/checkerframework/checker/units/qual/m3.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,20 @@ | ||
package org.checkerframework.checker.units.qual; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import org.checkerframework.framework.qual.SubtypeOf; | ||
|
||
/** | ||
* Cubic meter. | ||
* | ||
* @checker_framework.manual #units-checker Units Checker | ||
*/ | ||
@Documented | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
@SubtypeOf(Volume.class) | ||
@SuppressWarnings("checkstyle:typename") | ||
public @interface m3 {} |
20 changes: 20 additions & 0 deletions
20
checker-qual/src/main/java/org/checkerframework/checker/units/qual/mm3.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,20 @@ | ||
package org.checkerframework.checker.units.qual; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import org.checkerframework.framework.qual.SubtypeOf; | ||
|
||
/** | ||
* Cubic millimeter. | ||
* | ||
* @checker_framework.manual #units-checker Units Checker | ||
*/ | ||
@Documented | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
@SubtypeOf(Volume.class) | ||
@SuppressWarnings("checkstyle:typename") | ||
public @interface mm3 {} |
22 changes: 22 additions & 0 deletions
22
checker-qual/src/main/java/org/checkerframework/checker/units/qual/t.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,22 @@ | ||
package org.checkerframework.checker.units.qual; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import org.checkerframework.framework.qual.SubtypeOf; | ||
|
||
/** | ||
* Metric ton. | ||
* | ||
* @checker_framework.manual #units-checker Units Checker | ||
*/ | ||
@Documented | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) | ||
@SubtypeOf(Mass.class) | ||
// TODO: support arbitrary factors? | ||
// @UnitsMultiple(quantity=kg.class, factor=1000) | ||
@SuppressWarnings("checkstyle:typename") | ||
public @interface t {} |
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
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
Oops, something went wrong.