CAVALCANTE, F. N.; http://lattes.cnpq.br/1723761355629636; CAVALCANTE, Filipe Neves.
Resumo:
Java Collections Framework (JCF) offers a set of Abstract Data Types (ADTs) in the Java language, being a widely used framework. However, because particularities of each collection the usage are neglected in favor of practicality, beingvery common,for example, the use of lists without allowing repetitions of elements, as if they were a set ADT. There are semiautomatic approaches to correct this type of problem, but they insert adaptive classes to the original code, which is not always desirable. Direct substitution, however, only exchanges a method call for another(s) corresponding(s), making as few changes as possible, appearing to be a better option. However, it is more complex ,which leads this work to study the conditions and consequences to make it possible. It was developed transformations implemented in a program rewriting environment, which were tested and analyzed through a case study, anend to verify its application, and also through a questionnaire aimed at Java programmers, which analyzed the acceptability of transformations in two sections of code. Asacasestudy results, there is an occurrence of 14% of the works that make use of lists acting as sets. And an ArrayList presented higher incidence (90%) and List itself cases (10%). Regarding the revisions made by the Java developers in the questionnaire, about 45% of the participants proposed suggestions considered appropriate, according to an API and JCF [1], for a section of code that used the add (E e) method of List , And 25% of them for another section that performed a call of the method set (int index, E and). With this, we can see the relevance of the problem, being necessary to continue to develop new techniques and tools that will make a program using collection properly, making it more readable and efficient .