A Java Compiler Plugin for Type-Safe Inferences in Generics

The two most significant yet complex elements of Java generics are wildcards and type argument inference. Both processes rely on the compiler. Even though type argument inference and wildcard execution are implicit processes, a programmer should be aware of them to make the most of the features. A c...

Full description

Saved in:
Bibliographic Details
Main Authors: Neha Kumari, Rajeev Kumar
Format: Article
Language:English
Published: Graz University of Technology 2025-03-01
Series:Journal of Universal Computer Science
Subjects:
Online Access:https://lib.jucs.org/article/106159/download/pdf/
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1850064128590217216
author Neha Kumari
Rajeev Kumar
author_facet Neha Kumari
Rajeev Kumar
author_sort Neha Kumari
collection DOAJ
description The two most significant yet complex elements of Java generics are wildcards and type argument inference. Both processes rely on the compiler. Even though type argument inference and wildcard execution are implicit processes, a programmer should be aware of them to make the most of the features. A compiler error message tells much about the code and the process mechanism. If the error message is unambiguous and sound, it is easy for the programmer to debug the code. However, in the context of wildcard-type argument inference, the current Javac compiler emits cryptic and imprecise error messages. A programmer may get confused about the inference outcome and failure, so it will be difficult to resolve the errors easily. In this paper, we propose a few additions to the current Wildcard-based type inference algorithm to get detailed and valuable error messages. We implement a Java compiler plugin tool based on the proposed algorithm. The plugin can be easily executed through the Java command line. It gives a comprehensive error message that aids programmers in resolving errors more effectively.
format Article
id doaj-art-bbd7effcc61141dd92bf9cd22abaa6fd
institution DOAJ
issn 0948-6968
language English
publishDate 2025-03-01
publisher Graz University of Technology
record_format Article
series Journal of Universal Computer Science
spelling doaj-art-bbd7effcc61141dd92bf9cd22abaa6fd2025-08-20T02:49:23ZengGraz University of TechnologyJournal of Universal Computer Science0948-69682025-03-0131431233710.3897/jucs.106159106159A Java Compiler Plugin for Type-Safe Inferences in GenericsNeha Kumari0Rajeev Kumar1Jawaharlal Nehru UniversityJawaharlal Nehru UniversityThe two most significant yet complex elements of Java generics are wildcards and type argument inference. Both processes rely on the compiler. Even though type argument inference and wildcard execution are implicit processes, a programmer should be aware of them to make the most of the features. A compiler error message tells much about the code and the process mechanism. If the error message is unambiguous and sound, it is easy for the programmer to debug the code. However, in the context of wildcard-type argument inference, the current Javac compiler emits cryptic and imprecise error messages. A programmer may get confused about the inference outcome and failure, so it will be difficult to resolve the errors easily. In this paper, we propose a few additions to the current Wildcard-based type inference algorithm to get detailed and valuable error messages. We implement a Java compiler plugin tool based on the proposed algorithm. The plugin can be easily executed through the Java command line. It gives a comprehensive error message that aids programmers in resolving errors more effectively.https://lib.jucs.org/article/106159/download/pdf/Java GenericsPluginType Argument InferenceTy
spellingShingle Neha Kumari
Rajeev Kumar
A Java Compiler Plugin for Type-Safe Inferences in Generics
Journal of Universal Computer Science
Java Generics
Plugin
Type Argument Inference
Ty
title A Java Compiler Plugin for Type-Safe Inferences in Generics
title_full A Java Compiler Plugin for Type-Safe Inferences in Generics
title_fullStr A Java Compiler Plugin for Type-Safe Inferences in Generics
title_full_unstemmed A Java Compiler Plugin for Type-Safe Inferences in Generics
title_short A Java Compiler Plugin for Type-Safe Inferences in Generics
title_sort java compiler plugin for type safe inferences in generics
topic Java Generics
Plugin
Type Argument Inference
Ty
url https://lib.jucs.org/article/106159/download/pdf/
work_keys_str_mv AT nehakumari ajavacompilerpluginfortypesafeinferencesingenerics
AT rajeevkumar ajavacompilerpluginfortypesafeinferencesingenerics
AT nehakumari javacompilerpluginfortypesafeinferencesingenerics
AT rajeevkumar javacompilerpluginfortypesafeinferencesingenerics