V
V
vmc12018-04-06 16:43:11
Java
vmc1, 2018-04-06 16:43:11

Is it planned to make type synonyms in Java (like typedef in c++ or type aliases in Scala)?

Is it planned to make type synonyms in Java (like typedef in c++ or type aliases in Scala)?
I would like instead
of void save(long customerId, long referenceId);
write
void save(CustomerId customerId, RefId referenceId);
Is it possible to write this wish somewhere in Jira for OpenJDK?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2018-04-07
@rPman

If I understand correctly, this is outside the ideology of the language.
In your case, you should create your class based on Number, by the way, based on your example, if you use generic types, you will have problems with null (they cannot be null)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question