Bonjour,

Pour l'instant, je suis en JDK11, mais je me pose la question de migré en JDK25 (si LTS).
Mais, je me dis qu'il serait bien d'utiliser les nouvelles fonctionnalité des JDK, en outre la class reccord.

Mais, migré pour juste avoir une version plus récente, je ne suis pas certains que cela soit très un bon choix.
Donc, je brainstorm...

Pour ce qui est de la class de type reccord, je peux par exemple convertir celle-ci :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
public class def_formula
	{
	int action = 0;
  int type = 0;
  String operande = "";
  String operation = "";
 
  /**
   * Constructor
   * 
   * @param iAction
   * @param iType
   * @param sOperande
   * @param sOperation
   */
  public def_formula(int iAction, int iType, String sOperande, String sOperation)
    {
    action = iAction;
    type = iType;
    operande = sOperande;
    operation = sOperation;
    }
 
	/**
         * @return the action
         */
	public int getAction()
		{
		return action;
		}
 
	/**
         * @return the type
         */
	public int getType()
		{
		return type;
		}
 
	/**
         * @return the operande
         */
	public String getOperande()
		{
		return operande;
		}
 
	/**
         * @return the operation
         */
	public String getOperation()
		{
		return operation;
		}
	}
en

reccord def_formula(int action, int type, String operande, String operation) {}

Mais, cela veut dire que je dois remplacer les appels :

  • getAction() par action()
  • getType() par type()
  • getOperande() par operande()
  • getOperation() par operation()


D'ailleurs, question annexe : une class de type reccord peut-il être encapsulé dans une ArrayList ou un Vecteur ?

Ce qui donnerait (en utilisant les class de type reccord) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 def_formula formula = null;
 
  for(int i = 0; i < alFormula.size(); i++)
       {  
       formula = alFormula.get(i);
     	 priorite = formula.getAction();
     	 PLog.debug("executing line " + priorite);
 
         double value1 = 0, value2 = 0;
 
     	   switch(formula.type())
....
st = new StringTokenizer(formulaoperande(),";");
Est-ce que cela vaut la peine de faire ce genre de modification ou vaut-il mieux laisser ainsi.

Bref, il y a deux questions dans ce post :
- Interet à migrer en JDK 25
- Usage d'adapter certaines class en class de type reccord.

Désolé si le post est un peu chao, mais en écrivant, je réfléchis et "brainstorm"